Fix a few coverity complaints
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 10 Nov 2020 03:09:00 +0000 (13:09 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 16 Nov 2020 03:44:05 +0000 (13:44 +1000)
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 <peter.hutterer@who-t.net>
(cherry picked from commit cfd8e6c76c9be6c4ebdbc4e822762be4a30142e6)

src/builddir.h
src/evdev-mt-touchpad-thumb.c
test/litest-selftest.c

index 19825759a5193aebb6d694a6bb05103ac1865bd3..84aa8f68e81a2ebdb88e8dd24de57050561821d5 100644 (file)
@@ -35,7 +35,7 @@
 static inline char *
 builddir_lookup(void)
 {
-       char execdir[PATH_MAX] = {0};
+       char execdir[PATH_MAX];
        char *pathsep;
        ssize_t nread;
 
index 2beaa54c93886ecfeecc3793bbc0222078bc4c4b..17b324e25e0ccaa1fe4b978b59d591f68b6eafc0 100644 (file)
@@ -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;
        }
index 75662a01b565ebe65a41e17aebae9329915b4b10..b7fbdb56453b874b01f94f8f42a4c65053dca73a 100644 (file)
@@ -350,7 +350,7 @@ END_TEST
 
 START_TEST(zalloc_overflow)
 {
-       zalloc(-1);
+       zalloc((size_t)-1);
 }
 END_TEST