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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Meerwald <p.meerwald@xxxxxxxxxxxxxxxxxx>

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 <p.meerwald@xxxxxxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux