Skip to content

Commit bc49961

Browse files
KunWuChandtor
authored andcommitted
Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails
While input core can work with input->phys set to NULL userspace might depend on it, so better fail probing if allocation fails. The system must be in a pretty bad shape for it to happen anyway. Signed-off-by: Kunwu Chan <chentao@kylinos.cn> Link: https://lore.kernel.org/r/20240117073124.143636-1-chentao@kylinos.cn Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent f0eb58d commit bc49961

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/input/rmi4/rmi_driver.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,11 @@ static int rmi_driver_probe(struct device *dev)
11961196
}
11971197
rmi_driver_set_input_params(rmi_dev, data->input);
11981198
data->input->phys = devm_kasprintf(dev, GFP_KERNEL,
1199-
"%s/input0", dev_name(dev));
1199+
"%s/input0", dev_name(dev));
1200+
if (!data->input->phys) {
1201+
retval = -ENOMEM;
1202+
goto err;
1203+
}
12001204
}
12011205

12021206
retval = rmi_init_functions(data);

0 commit comments

Comments
 (0)