mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] i2c: Fix barebox crash when 'count' is not set for i2c_read command
Date: Sat, 12 May 2012 00:17:07 +0400	[thread overview]
Message-ID: <1336767428-21412-1-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <20120511200205.GT27341@pengutronix.de>

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

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 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

  reply	other threads:[~2012-05-11 20:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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: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             ` Alexander Shiyan [this message]
2012-05-11 20:17             ` 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1336767428-21412-1-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox