mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] at91: sama5d3: fix off-by-one array boundary checking for pdata_i2c
@ 2013-06-04  1:42 Axel Lin
  0 siblings, 0 replies; only message in thread
From: Axel Lin @ 2013-06-04  1:42 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

i2c_id is used as array subscript, so it's valid value range is
0 ... ARRAY_SIZE -1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 arch/arm/mach-at91/sama5d3_devices.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/sama5d3_devices.c b/arch/arm/mach-at91/sama5d3_devices.c
index 031168b..e456bd0 100644
--- a/arch/arm/mach-at91/sama5d3_devices.c
+++ b/arch/arm/mach-at91/sama5d3_devices.c
@@ -322,7 +322,7 @@ void at91_add_device_i2c(short i2c_id, struct i2c_board_info *devices, int nr_de
 {
 	struct i2c_gpio_platform_data *pdata;
 
-	if (i2c_id > ARRAY_SIZE(pdata_i2c))
+	if (i2c_id >= ARRAY_SIZE(pdata_i2c))
 		return;
 
 	i2c_register_board_info(i2c_id, devices, nr_devices);
-- 
1.8.1.2




_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-04  1:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-04  1:42 [PATCH] at91: sama5d3: fix off-by-one array boundary checking for pdata_i2c Axel Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox