mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] i2c: Fix barebox crash when 'count' is not set for i2c_read command
@ 2012-05-11 15:42 Alexander Shiyan
  2012-05-11 15:42 ` [PATCH 2/2] i2c: Added switch for allowing usage 16bit register addresses Alexander Shiyan
  2012-05-11 18:12 ` [PATCH 1/2] i2c: Fix barebox crash when 'count' is not set for i2c_read command Sascha Hauer
  0 siblings, 2 replies; 10+ messages in thread
From: Alexander Shiyan @ 2012-05-11 15:42 UTC (permalink / raw)
  To: barebox

Running i2c_read without the 'count' setting causes an error and reboots.

barebox@Phytec phyCORE-i.MX27:/ i2c_read -b 1 -a 0x4a -r 0x00
ERROR: out of memory
no stack data available
---
 commands/i2c.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/commands/i2c.c b/commands/i2c.c
index b3d09dc..39bae35 100644
--- a/commands/i2c.c
+++ b/commands/i2c.c
@@ -170,7 +170,7 @@ static int do_i2c_read(int argc, char *argv[])
 		}
 	}
 
-	if ((addr < 0) || (reg < 0) || (count == 0) || (addr > 0x7F))
+	if ((addr < 0) || (reg < 0) || (count < 1) || (addr > 0x7F))
 		return COMMAND_ERROR_USAGE;
 
 	adapter = i2c_get_adapter(bus);
-- 
1.7.3.4


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-05-11 20:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-11 15:42 [PATCH 1/2] i2c: Fix barebox crash when 'count' is not set for i2c_read command Alexander Shiyan
2012-05-11 15:42 ` [PATCH 2/2] i2c: Added switch for allowing usage 16bit register addresses Alexander Shiyan
2012-05-11 18:15   ` Sascha Hauer
2012-05-11 18:17     ` Re[2]: " Alexander Shiyan
2012-05-11 18:35       ` Sascha Hauer
2012-05-11 18:58         ` Alexander Shiyan
2012-05-11 20:02           ` Sascha Hauer
2012-05-11 20:17             ` [PATCH 1/2] i2c: Fix barebox crash when 'count' is not set for i2c_read command Alexander Shiyan
2012-05-11 20:17             ` [PATCH 2/2] i2c: Added switch for allowing usage 16bit register addresses Alexander Shiyan
2012-05-11 18:12 ` [PATCH 1/2] i2c: Fix barebox crash when 'count' is not set for i2c_read command Sascha Hauer

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