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: 266c990deb
("HID: Add WinWing Orion2 throttle support")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
This commit is contained in:
parent
05c4ede695
commit
45ab5166a8
1 changed files with 2 additions and 0 deletions
|
@ -106,6 +106,8 @@ static int winwing_init_led(struct hid_device *hdev,
|
|||
"%s::%s",
|
||||
dev_name(&input->dev),
|
||||
info->led_name);
|
||||
if (!led->cdev.name)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = devm_led_classdev_register(&hdev->dev, &led->cdev);
|
||||
if (ret)
|
||||
|
|
Loading…
Add table
Reference in a new issue