diff options
author | Haoran Liu <liuhaoran14@163.com> | 2023-12-03 19:00:23 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-08 11:25:03 +0100 |
commit | 373046659885496e9ecbf440be5e2965c56251f2 (patch) | |
tree | e2349ef7b01bd9d98bf83e42254ab489a2f8e779 | |
parent | 38951600863773388f6939f7e5fbe09a657ecdc4 (diff) | |
download | linux-stable-373046659885496e9ecbf440be5e2965c56251f2.tar.gz linux-stable-373046659885496e9ecbf440be5e2965c56251f2.tar.bz2 linux-stable-373046659885496e9ecbf440be5e2965c56251f2.zip |
Input: ipaq-micro-keys - add error handling for devm_kmemdup
[ Upstream commit 59b6a747e2d39227ac2325c5e29d6ab3bb070c2a ]
Check the return value of i2c_add_adapter. Static analysis revealed that
the function did not properly handle potential failures of
i2c_add_adapter, which could lead to partial initialization of the I2C
adapter and unstable operation.
Signed-off-by: Haoran Liu <liuhaoran14@163.com>
Link: https://lore.kernel.org/r/20231203164653.38983-1-liuhaoran14@163.com
Fixes: d7535ffa427b ("Input: driver for microcontroller keys on the iPaq h3xxx")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/input/keyboard/ipaq-micro-keys.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/input/keyboard/ipaq-micro-keys.c b/drivers/input/keyboard/ipaq-micro-keys.c index 602900d1f937..2d0d09ee9ab0 100644 --- a/drivers/input/keyboard/ipaq-micro-keys.c +++ b/drivers/input/keyboard/ipaq-micro-keys.c @@ -108,6 +108,9 @@ static int micro_key_probe(struct platform_device *pdev) keys->codes = devm_kmemdup(&pdev->dev, micro_keycodes, keys->input->keycodesize * keys->input->keycodemax, GFP_KERNEL); + if (!keys->codes) + return -ENOMEM; + keys->input->keycode = keys->codes; __set_bit(EV_KEY, keys->input->evbit); |