qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/5] vhost-user-input: check ioctl(EVIOCGNAME) r


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 4/5] vhost-user-input: check ioctl(EVIOCGNAME) return value
Date: Fri, 7 Jun 2019 09:50:36 +0100

On Wed, 5 Jun 2019 at 16:04, Marc-André Lureau
<address@hidden> wrote:
>
> This should fix coverity CID 1401704.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
>  contrib/vhost-user-input/main.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c
> index 54f882602a..8b4e7d2536 100644
> --- a/contrib/vhost-user-input/main.c
> +++ b/contrib/vhost-user-input/main.c
> @@ -342,7 +342,11 @@ main(int argc, char *argv[])
>
>      vi.config = g_array_new(false, false, sizeof(virtio_input_config));
>      memset(&id, 0, sizeof(id));
> -    ioctl(vi.evdevfd, EVIOCGNAME(sizeof(id.u.string) - 1), id.u.string);
> +    if (ioctl(vi.evdevfd, EVIOCGNAME(sizeof(id.u.string) - 1),
> +              id.u.string) < 0) {
> +        g_printerr("Failed to get evdev name: %s\n", g_strerror(errno));
> +        exit(EXIT_FAILURE);
> +    }


Reviewed-by: Peter Maydell <address@hidden>

thanks
-- PMM



reply via email to

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