qemu-stable
[Top][All Lists]
Advanced

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

Re: [Qemu-stable] [PATCH v2 2/2] ivshmem: add missing error exit(2)


From: Eric Blake
Subject: Re: [Qemu-stable] [PATCH v2 2/2] ivshmem: add missing error exit(2)
Date: Mon, 03 Jun 2013 06:26:22 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

On 06/03/2013 02:58 AM, Stefan Hajnoczi wrote:
> If the user fails to specify 'chardev' or 'shm' then we cannot continue.
> Exit right away so that we don't invoke shm_open(3) with a NULL pointer.
> 
> It would be nice to replace exit(1) with error returns in the PCI device
> .init() function, but leave that for another patch since exit(1) is
> currently used elsewhere.
> 
> Spotted by Coverity.
> 
> Cc: Cam Macdonell <address@hidden>
> Cc: address@hidden
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
>  hw/misc/ivshmem.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
> index a19a6d6..5658f73 100644
> --- a/hw/misc/ivshmem.c
> +++ b/hw/misc/ivshmem.c
> @@ -735,6 +735,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
>  
>          if (s->shmobj == NULL) {
>              fprintf(stderr, "Must specify 'chardev' or 'shm' to ivshmem\n");
> +            exit(1);

Reviewed-by: Eric Blake <address@hidden>

However, I prefer exit(EXIT_FAILURE) rather than exit(1), to make it a
bit easier to grep for known failure exits.  Libvirt has a syntax
checker (taken from gnulib) that enforces such a style, if qemu would
like to adopt that style.

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]