mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Alexander Shiyan <shc_work@mail.ru>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] i2c: Fix barebox crash when 'count' is not set for i2c_read command
Date: Fri, 11 May 2012 20:12:42 +0200	[thread overview]
Message-ID: <20120511181242.GJ27341@pengutronix.de> (raw)
In-Reply-To: <1336750939-18572-1-git-send-email-shc_work@mail.ru>

On Fri, May 11, 2012 at 07:42:18PM +0400, Alexander Shiyan wrote:
> Running i2c_read without the 'count' setting causes an error and reboots.
> 

Applied to master.

Thanks
 Sascha

> 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
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

      parent reply	other threads:[~2012-05-11 18:12 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             ` [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 ` Sascha Hauer [this message]

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=20120511181242.GJ27341@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=shc_work@mail.ru \
    /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