OSDN Git Service
(root)
/
uclinux-h8
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
93a2207
)
HID: potential dereference of null pointer
author
Jiasheng Jiang
<jiasheng@iscas.ac.cn>
Wed, 15 Dec 2021 08:36:05 +0000
(16:36 +0800)
committer
Benjamin Tissoires
<benjamin.tissoires@redhat.com>
Mon, 20 Dec 2021 10:26:14 +0000
(11:26 +0100)
The return value of devm_kzalloc() needs to be checked.
To avoid hdev->dev->driver_data to be null in case of the failure of
alloc.
Fixes:
14c9c014babe
("HID: add vivaldi HID driver")
Cc: stable@vger.kernel.org
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link:
https://lore.kernel.org/r/20211215083605.117638-1-jiasheng@iscas.ac.cn
drivers/hid/hid-vivaldi.c
patch
|
blob
|
history
diff --git
a/drivers/hid/hid-vivaldi.c
b/drivers/hid/hid-vivaldi.c
index
cd7ada4
..
72957a9
100644
(file)
--- a/
drivers/hid/hid-vivaldi.c
+++ b/
drivers/hid/hid-vivaldi.c
@@
-57,6
+57,9
@@
static int vivaldi_probe(struct hid_device *hdev,
int ret;
drvdata = devm_kzalloc(&hdev->dev, sizeof(*drvdata), GFP_KERNEL);
+ if (!drvdata)
+ return -ENOMEM;
+
hid_set_drvdata(hdev, drvdata);
ret = hid_parse(hdev);