[libvirt] [PATCH 7/8] qemu: Resolve Coverity BAD_SIZEOF
Peter Krempa
pkrempa at redhat.com
Mon Sep 15 15:00:15 UTC 2014
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 at redhat.com>
>>> ---
>>> 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 :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140915/09c7fea7/attachment-0001.sig>
More information about the libvir-list
mailing list