aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-06-05 16:58:28 +0200
committerMichael S. Tsirkin <mst@redhat.com>2019-06-16 16:16:52 -0400
commitbe32fd9ee1d85e682d652d11b6e32e7f700420bb (patch)
tree124e8e2543408e7f75c329dac61100dcc4768b24 /contrib
parentf55411cf143f868e70cd769171fa1db8953a626e (diff)
vhost-user-input: check ioctl(EVIOCGNAME) return value
This should fix coverity CID 1401704. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190605145829.7674-5-marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/vhost-user-input/main.c6
1 files changed, 5 insertions, 1 deletions
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);
+ }
id.select = VIRTIO_INPUT_CFG_ID_NAME;
id.size = strlen(id.u.string);
g_array_append_val(vi.config, id);