Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

HID: winwing: Add NULL check in winwing_init_led()

devm_kasprintf() can return a NULL pointer on failure,but this
returned value in winwing_init_led() is not checked.
Add NULL check in winwing_init_led(), to handle kernel NULL
pointer dereference error.

Fixes: 266c990debad ("HID: Add WinWing Orion2 throttle support")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>

authored by

Charles Han and committed by
Jiri Kosina
45ab5166 05c4ede6

+2
+2
drivers/hid/hid-winwing.c
··· 106 106 "%s::%s", 107 107 dev_name(&input->dev), 108 108 info->led_name); 109 + if (!led->cdev.name) 110 + return -ENOMEM; 109 111 110 112 ret = devm_led_classdev_register(&hdev->dev, &led->cdev); 111 113 if (ret)