From: Stefan Hajnoczi Date: Mon, 3 Jun 2013 08:58:31 +0000 (+0200) Subject: ivshmem: add missing error exit(2) X-Git-Tag: v1.5.1~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b6f105349f5ef55c6a93193d8618524078f069b;p=thirdparty%2Fqemu.git ivshmem: add missing error exit(2) 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 Cc: qemu-stable@nongnu.org Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Signed-off-by: Michael Tokarev (cherry picked from commit baefb8bf8e4a708c601bbab898a6039cd9cd12e3) Signed-off-by: Michael Roth --- diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index a19a6d6d8ca..5658f733f40 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); } IVSHMEM_DPRINTF("using shm_open (shm object = %s)\n", s->shmobj);