Re: [PATCH libvirt-python 07/17] Remove use of VIR_ALLOC_N

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

 



On 09/09/2013 10:01 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  libvirt-override.c | 106 ++++++++++++++++++++++++++---------------------------
>  1 file changed, 53 insertions(+), 53 deletions(-)

Do we really want to make this change?  It makes maintenance harder to
reason about.  I'd lean instead towards adding a single internal header,
where we #define VIR_ALLOC_N, so that existing code can continue to use
the nicer interface (where it's harder to typo the sizeof(*var)*len).
Furthermore, VIR_ALLOC_N has bounds checking (it ensures OOM failure if
sizeof()*len would overflow) that you are losing in your rewrite.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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]