diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2013-06-03 10:58:31 +0200 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2013-06-12 13:17:53 +0400 |
commit | baefb8bf8e4a708c601bbab898a6039cd9cd12e3 (patch) | |
tree | cbc9aa4ae7dd0acc1a9dcd88a382fcf8fa642fbe /hw | |
parent | c5633d998a27502ad8cc10c2d46f91b02555ae7a (diff) |
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 <cam@cs.ualberta.ca>
Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/misc/ivshmem.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index a19a6d6d8c..5658f733f4 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); |