Thread (16 messages) 16 messages, 4 authors, 2013-02-20
STALE4864d

[PATCH 7/7] input: atmel_mxt_ts: check if all config pdata has been written to object table

From: Peter Meerwald <hidden>
Date: 2013-02-07 14:18:03
Subsystem: atmel maxtouch driver, input (keyboard, mouse, joystick, touchscreen) drivers, the rest · Maintainers: Nick Dyer, Dmitry Torokhov, Linus Torvalds

From: Peter Meerwald <redacted>

firmware revisions may introduce or alter device objects; error out if there
is an inconsistency (otherwise the device may silently fail)

mxt_platform_data.config is dangerous because the data must match the device object
exactly; if the order or size changes, or if device object disappear, garbage is written
to the device

Signed-off-by: Peter Meerwald <redacted>
---
 drivers/input/touchscreen/atmel_mxt_ts.c |    5 +++++
 1 file changed, 5 insertions(+)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 7ade272..b85fb30 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -636,6 +636,11 @@ static int mxt_check_reg_init(struct mxt_data *data)
 		index += size;
 	}
 
+	if (index != pdata->config_length) {
+		dev_err(dev, "Config data inconsistent with device objects!\n");
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
-- 
1.7.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help