On Fri, Mar 07, 2014 at 06:53:12PM +0800, Chunyan Liu wrote:This is reasonable because it is an expected case.
> Check NULL parameter inputs
>
> Signed-off-by: Chunyan Liu <cyliu@suse.com>
> ---
> src/util/virhostdev.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 57 insertions(+)
>
> diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
> index 577de48..5f61bfc 100644
> --- a/src/util/virhostdev.c
> +++ b/src/util/virhostdev.c
> @@ -468,6 +468,11 @@ virHostdevPreparePciHostdevs(virHostdevManagerPtr hostdev_mgr,
> size_t i;
> int ret = -1;
>
> + if (!nhostdevs)
> + return 0;
This is something that should never happen except by programmer
> + if (hostdev_mgr == NULL)
> + return -1;
error, since this is allocated right at libvirtd startup and
then never changed thereafter.
It is preferrable to use ATTRIBUTE_NONNULL() in the header
file for these kind of things.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|