From cfd8e6c76c9be6c4ebdbc4e822762be4a30142e6 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 10 Nov 2020 13:09:00 +1000 Subject: [PATCH] Fix a few coverity complaints All minor: - execdir does not need initialization, it's not used until written to - 'newest' could be NULL - zalloc(-1) confuses coverity - 't' is never used in that test Signed-off-by: Peter Hutterer --- src/builddir.h | 2 +- src/evdev-mt-touchpad-thumb.c | 5 +++-- test/litest-selftest.c | 2 +- test/test-tablet.c | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/builddir.h b/src/builddir.h index 1982575..84aa8f6 100644 --- a/src/builddir.h +++ b/src/builddir.h @@ -35,7 +35,7 @@ static inline char * builddir_lookup(void) { - char execdir[PATH_MAX] = {0}; + char execdir[PATH_MAX]; char *pathsep; ssize_t nread; diff --git a/src/evdev-mt-touchpad-thumb.c b/src/evdev-mt-touchpad-thumb.c index 2beaa54..17b324e 100644 --- a/src/evdev-mt-touchpad-thumb.c +++ b/src/evdev-mt-touchpad-thumb.c @@ -358,8 +358,9 @@ tp_thumb_update_multifinger(struct tp_dispatch *tp) * the behavior of the other touches.) */ - if ((newest->initial_time - oldest->initial_time) < THUMB_TIMEOUT && - first->point.y < tp->thumb.lower_thumb_line) { + if (newest && + (newest->initial_time - oldest->initial_time) < THUMB_TIMEOUT && + first->point.y < tp->thumb.lower_thumb_line) { tp_thumb_lift(tp); return; } diff --git a/test/litest-selftest.c b/test/litest-selftest.c index 75662a0..b7fbdb5 100644 --- a/test/litest-selftest.c +++ b/test/litest-selftest.c @@ -350,7 +350,7 @@ END_TEST START_TEST(zalloc_overflow) { - zalloc(-1); + zalloc((size_t)-1); } END_TEST diff --git a/test/test-tablet.c b/test/test-tablet.c index 719257c..73c0074 100644 --- a/test/test-tablet.c +++ b/test/test-tablet.c @@ -2874,8 +2874,8 @@ START_TEST(tool_type) type == LIBINPUT_TABLET_TOOL_TYPE_PEN) { libinput_event_destroy(event); event = libinput_get_event(li); - t = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + litest_is_tablet_event(event, + LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); libinput_event_destroy(event); event = libinput_get_event(li); t = litest_is_tablet_event(event, -- 2.7.4