Re: [PATCH 7/8] qemu: Resolve Coverity BAD_SIZEOF

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

 



On 09/15/14 16:57, John Ferlan wrote:
> 
> 
> On 09/15/2014 04:09 AM, Peter Krempa wrote:
>> On 09/13/14 15:27, John Ferlan wrote:
>>> Coverity complains about the calculation of the buf & len within
>>> the PROBE macro.  So to quiet things down, do the calculation prior
>>> to usage in either write() or qemuMonitorIOWriteWithFD() calls and
>>> then have the PROBE use the calculated values - which works.
>>>
>>> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
>>> ---
>>>  src/qemu/qemu_monitor.c | 18 +++++++-----------
>>>  1 file changed, 7 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
>>> index 6059133..80c6ef8 100644
>>> --- a/src/qemu/qemu_monitor.c
>>> +++ b/src/qemu/qemu_monitor.c
>>> @@ -478,6 +478,8 @@ static int
>>>  qemuMonitorIOWrite(qemuMonitorPtr mon)
>>>  {
>>>      int done;
>>> +    char *buf;
>>> +    int len;
>>
>> len should be "size_t"
>>
> 
> Of course seen when formatting %d on the PROBE() I was reminded I had to
> change the type of the printf format ;-)... Also, I would be remiss if I
> didn't point out...
> 
> struct _qemuMonitorMessage {
>     int txFD;
> 
>     char *txBuffer;
>     int txOffset;
>     int txLength;

Sigh, definitely not the last place with incorrect types :)


Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]