qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 02/18] replay: internal functions for replay log


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PULL 02/18] replay: internal functions for replay log
Date: Fri, 11 May 2018 11:51:00 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]