]> Git Repo - qemu.git/commitdiff
ivshmem: add missing error exit(2)
authorStefan Hajnoczi <[email protected]>
Mon, 3 Jun 2013 08:58:31 +0000 (10:58 +0200)
committerMichael Tokarev <[email protected]>
Wed, 12 Jun 2013 09:17:53 +0000 (13:17 +0400)
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 <[email protected]>
Cc: [email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
hw/misc/ivshmem.c

index a19a6d6d8ca843639e4f4555f89de5101730c150..5658f733f40b741c1e74baf685bbf4e6834d5d48 100644 (file)
@@ -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);
         }
 
         IVSHMEM_DPRINTF("using shm_open (shm object = %s)\n", s->shmobj);
This page took 0.023088 seconds and 4 git commands to generate.