]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
HID: pidff: Fix condition effect bit clearing
authorTomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Wed, 4 Feb 2026 21:44:55 +0000 (22:44 +0100)
committerJiri Kosina <jkosina@suse.com>
Sat, 21 Feb 2026 09:47:12 +0000 (10:47 +0100)
As reported by MPDarkGuy on discord, NULL pointer dereferences were
happening because not all the conditional effects bits were cleared.

Properly clear all conditional effect bits from ffbit

Fixes: 7f3d7bc0df4b ("HID: pidff: Better quirk assigment when searching for fields")
Cc: stable@vger.kernel.org # 6.18.x
Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/usbhid/hid-pidff.c

index a4e700b40ba9b48ae3fda4001d2acf3200ff7445..56d6af39ba81ea3417b0a816828b5f3773c79539 100644 (file)
@@ -1452,10 +1452,13 @@ static int pidff_init_fields(struct pidff_device *pidff, struct input_dev *dev)
                hid_warn(pidff->hid, "unknown ramp effect layout\n");
 
        if (PIDFF_FIND_FIELDS(set_condition, PID_SET_CONDITION, 1)) {
-               if (test_and_clear_bit(FF_SPRING, dev->ffbit)   ||
-                   test_and_clear_bit(FF_DAMPER, dev->ffbit)   ||
-                   test_and_clear_bit(FF_FRICTION, dev->ffbit) ||
-                   test_and_clear_bit(FF_INERTIA, dev->ffbit))
+               bool test = false;
+
+               test |= test_and_clear_bit(FF_SPRING, dev->ffbit);
+               test |= test_and_clear_bit(FF_DAMPER, dev->ffbit);
+               test |= test_and_clear_bit(FF_FRICTION, dev->ffbit);
+               test |= test_and_clear_bit(FF_INERTIA, dev->ffbit);
+               if (test)
                        hid_warn(pidff->hid, "unknown condition effect layout\n");
        }