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: Fri, 11 May 2012 19:42:18 +0400 [thread overview]
Message-ID: <1336750939-18572-1-git-send-email-shc_work@mail.ru> (raw)
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
next reply other threads:[~2012-05-11 15:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-11 15:42 Alexander Shiyan [this message]
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
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=1336750939-18572-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