diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2021-12-15 16:36:05 +0800 |
---|---|---|
committer | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2021-12-20 11:26:14 +0100 |
commit | 13251ce1dd9bb525da2becb9b26fdfb94ca58659 (patch) | |
tree | e8d8117d177ba7e85e64a429febf490e49922e8d /drivers/hid | |
parent | 93a2207c254ca102ebbdae47b00f19bbfbfa7ecd (diff) | |
download | linux-13251ce1dd9bb525da2becb9b26fdfb94ca58659.tar.gz linux-13251ce1dd9bb525da2becb9b26fdfb94ca58659.tar.bz2 linux-13251ce1dd9bb525da2becb9b26fdfb94ca58659.zip |
HID: potential dereference of null pointer
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
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-vivaldi.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hid/hid-vivaldi.c b/drivers/hid/hid-vivaldi.c index cd7ada48b1d9..72957a9f7117 100644 --- 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); |