Skip to content

Commit 59b6a74

Browse files
Haoran Liudtor
authored andcommitted
Input: ipaq-micro-keys - add error handling for devm_kmemdup
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: d7535ff ("Input: driver for microcontroller keys on the iPaq h3xxx") Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 42b8ff4 commit 59b6a74

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/input/keyboard/ipaq-micro-keys.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ static int micro_key_probe(struct platform_device *pdev)
105105
keys->codes = devm_kmemdup(&pdev->dev, micro_keycodes,
106106
keys->input->keycodesize * keys->input->keycodemax,
107107
GFP_KERNEL);
108+
if (!keys->codes)
109+
return -ENOMEM;
110+
108111
keys->input->keycode = keys->codes;
109112

110113
__set_bit(EV_KEY, keys->input->evbit);

0 commit comments

Comments
 (0)