From 0ee29814c6be17a924761d3712eb8ad63cfe13ac Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Mon, 12 Dec 2022 20:49:35 -0800 Subject: HID: playstation: fix free of uninialized pointer for DS4 in Bluetooth. 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 Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20221213044935.1775499-2-roderick.colenbrander@sony.com --- drivers/hid/hid-playstation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/hid/hid-playstation.c') diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c index 7b5aef538044..f399bf0d3c8c 100644 --- a/drivers/hid/hid-playstation.c +++ b/drivers/hid/hid-playstation.c @@ -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: -- cgit