Re: [PATCH 7/7] util: Avoid Coverity FORWARD_NULL

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

 



On Wed, Jul 01, 2015 at 10:03:51 -0400, John Ferlan wrote:
> Avoid a false positive since Coverity find a path in virResizeN which
> could return 0 prior to the allocation of memory and thus flags a
> possible NULL dereference. Instead use multiple loops to first count
> the number of matches, perform one allocation, and then again search
> for matches.  It's a 'n' string comparisons and allocations versus
> 2*'n' string comparisons and one allocation.

Another option would be to alloc *ret to nparams and fill only the
matched ones leaving a part of the array unused. Since this will be
used mainly in cases where n will be a rather small number (I think
libvirt is able to support ~250 disks max) the memory overhead won't be
noticable.

Peter

Attachment: signature.asc
Description: 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]