HID: playstation: fix free of uninialized pointer for DS4 in Bluetooth.
authorRoderick Colenbrander <roderick@gaikai.com>
Tue, 13 Dec 2022 04:49:35 +0000 (20:49 -0800)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Mon, 19 Dec 2022 12:18:02 +0000 (13:18 +0100)
The 'buf' variable is only used in the USB (if-path) and not in the Bluetooth
else-path. Since it is not set to NULL. this results in freeing an uninitialized
pointer. Since the else code-path doesn't need buf, just return 0.

Fixes: 2d77474a2392 ("HID: playstation: add DualShock4 bluetooth support.")
Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20221213044935.1775499-2-roderick.colenbrander@sony.com
drivers/hid/Kconfig
drivers/hid/hid-playstation.c

index 17cce4c..e2a5d30 100644 (file)
@@ -897,7 +897,7 @@ config HID_PLAYSTATION
        select CRC32
        select POWER_SUPPLY
        help
-         Provides support for Sony PS5 controllers including support for
+         Provides support for Sony PS4/PS5 controllers including support for
          its special functionalities e.g. touchpad, lights and motion
          sensors.
 
index 7b5aef5..f399bf0 100644 (file)
@@ -1916,7 +1916,7 @@ static int dualshock4_get_mac_address(struct dualshock4 *ds4)
                if (ret != sizeof(ds4->base.mac_address))
                        return -EINVAL;
 
-               ret = 0;
+               return 0;
        }
 
 err_free: