Skip to contentSkip to conversation

Input: st-keyscan - fix potential zalloc NULL dereference

PATCH In review [email protected] 1 participant 2 messages Feb 12, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: st-keyscan - fix potential zalloc NULL dereference

From: Gabriel Fernandez <[email protected]>

This patch fixes the following static checker warning:

drivers/input/keyboard/st-keyscan.c:156 keyscan_probe()
error: potential zalloc NULL dereference: 'keypad_data->input_dev'

---
 drivers/input/keyboard/st-keyscan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/keyboard/st-keyscan.c +2 -2
index babcfb165e4f..3b85631fde91 100644
@@ -153,6 +153,8 @@ static int keyscan_probe(struct platform_device *pdev)
 
 	input_dev->id.bustype = BUS_HOST;
 
+	keypad_data->input_dev = input_dev;
+
 	error = keypad_matrix_key_parse_dt(keypad_data);
 	if (error)
 		return error;
@@ -168,8 +170,6 @@ static int keyscan_probe(struct platform_device *pdev)
 
 	input_set_drvdata(input_dev, keypad_data);
 
-	keypad_data->input_dev = input_dev;
-
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	keypad_data->base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(keypad_data->base))
Signature · 1 line
2.17.0
#1 lore raw

Sorry ignore this patch (bad mailing list)

Best Regard

Gabriel

Quoted 35 lines · On 2/12/19 4:24 PM, [email protected] wrote:

From: Gabriel Fernandez <[email protected]>

This patch fixes the following static checker warning:

drivers/input/keyboard/st-keyscan.c:156 keyscan_probe()
error: potential zalloc NULL dereference: 'keypad_data->input_dev'

---
  drivers/input/keyboard/st-keyscan.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/keyboard/st-keyscan.c +2 -2
index babcfb165e4f..3b85631fde91 100644
@@ -153,6 +153,8 @@ static int keyscan_probe(struct platform_device *pdev)
 
  	input_dev->id.bustype = BUS_HOST;
 
+	keypad_data->input_dev = input_dev;
+
  	error = keypad_matrix_key_parse_dt(keypad_data);
  	if (error)
  		return error;
@@ -168,8 +170,6 @@ static int keyscan_probe(struct platform_device *pdev)
 
  	input_set_drvdata(input_dev, keypad_data);
 
-	keypad_data->input_dev = input_dev;
-
  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  	keypad_data->base = devm_ioremap_resource(&pdev->dev, res);
  	if (IS_ERR(keypad_data->base))