[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 02/11] vhost-user: check unix_listen() return val
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PULL 02/11] vhost-user: check unix_listen() return value |
Date: |
Wed, 26 Jun 2019 12:55:43 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
On 6/16/19 4:36 PM, Michael S. Tsirkin wrote:
> From: Marc-André Lureau <address@hidden>
>
> This check shouldn't be necessary, since &error_fatal is given as
> argument and will exit() on failure. However, this change should
> silence coverity CID 1401761 & 1401705.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> Message-Id: <address@hidden>
> Reviewed-by: Michael S. Tsirkin <address@hidden>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
> contrib/vhost-user-gpu/main.c | 4 ++++
> contrib/vhost-user-input/main.c | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/contrib/vhost-user-gpu/main.c b/contrib/vhost-user-gpu/main.c
> index 9614c9422c..e0b6df5b4d 100644
> --- a/contrib/vhost-user-gpu/main.c
> +++ b/contrib/vhost-user-gpu/main.c
> @@ -1160,6 +1160,10 @@ main(int argc, char *argv[])
>
> if (opt_socket_path) {
> int lsock = unix_listen(opt_socket_path, &error_fatal);
> + if (lsock < 0) {
> + g_printerr("Failed to listen on %s.\n", opt_socket_path);
> + exit(EXIT_FAILURE);
> + }
4 lines to appease Coverity; wouldn't the following one-liner also do
the trick?
int lsock = unix_listen(opt_socket_path, &error_fatal);
assert (lsock >= 0);
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 0/5] Misc vhost-user fixes, Marc-André Lureau, 2019/06/05
- [Qemu-devel] [PATCH 1/5] vhost-user-gpu: do not send scanout update if no GPU socket, Marc-André Lureau, 2019/06/05
- [Qemu-devel] [PATCH 2/5] vhost-user: check unix_listen() return value, Marc-André Lureau, 2019/06/05
- [Qemu-devel] [PATCH 3/5] vhost-user: improve error report, Marc-André Lureau, 2019/06/05
- [Qemu-devel] [PATCH 4/5] vhost-user-input: check ioctl(EVIOCGNAME) return value, Marc-André Lureau, 2019/06/05
- [Qemu-devel] [PATCH 5/5] vhost-user-gpu: initialize msghdr & iov at declaration, Marc-André Lureau, 2019/06/05