Received: from eggs.gnu.org ([2001:4830:134:3::10]:40229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fH4hg-0004sS-Qs for qemu-devel@nongnu.org; Fri, 11 May 2018 05:51:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fH4hd-0000kY-PF for qemu-devel@nongnu.org; Fri, 11 May 2018 05:51:08 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48090 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fH4hd-0000k8-Hn for qemu-devel@nongnu.org; Fri, 11 May 2018 05:51:05 -0400 References: <1446725643-82458-1-git-send-email-pbonzini@redhat.com> <1446725643-82458-3-git-send-email-pbonzini@redhat.com> From: Paolo Bonzini Message-ID: <8a22efa3-94a0-5ffa-17df-45702601624d@redhat.com> Date: Fri, 11 May 2018 11:51:00 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 02/18] replay: internal functions for replay log List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Pavel Dovgalyuk On 11/05/2018 11:27, Peter Maydell wrote: >> +uint8_t replay_get_byte(void) >> +{ >> + uint8_t byte = 0; >> + if (replay_file) { >> + byte = getc(replay_file); >> + } >> + return byte; >> +} > Coverity (CID 1390576) points out that this function isn't checking > the error return from getc(). That means we could incorrectly return > 255 from here and then the return value from replay_get_dword would > be 0xffffffff, which is unfortunate if the place that's using > that uses it as a loop boundary. Thanks! Pavel can you check it? How is error checking done in general for record/replay, should QEMU exit immediately? > Incidentally, is it worth adding something to our coverity model > to tell coverity that data from replay_get_byte() is not tainted? Good idea. Something like uint8_t replay_get_byte(void) { uint8_t byte; if (!replay_file) { return 0; } return byte; } should do. Paolo