From: "Uwe Kleine-König" <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Magnus Damm <magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>,
Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>,
Geert Uytterhoeven
<geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>,
Laurent Pinchart
<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver
Date: Sun, 23 Nov 2014 19:52:00 +0100 [thread overview]
Message-ID: <20141123185200.GD4431@pengutronix.de> (raw)
In-Reply-To: <20141122181406.GC9698@katana>
Hallo Wolfram,
On Sat, Nov 22, 2014 at 07:14:06PM +0100, Wolfram Sang wrote:
> > > > + case I2C_SLAVE_REQ_READ_END:
> > > > + eeprom->buffer_idx++;
> > > You don't check here for buffer_idx >= ARRAY_SIZE(buffer)?
> > > Ditto in the I2C_SLAVE_REQ_WRITE_END case.
> > I just noticed that buffer_idx is an u8, so it overflows at 255+1. So
> > the probe routine should error out if size is bigger than 256.
>
> But size is currently fixed to 256, so all is fine. Yes, if we extend it
> for bigger sizes, all that stuff needs to be taken care of, right.
yeah, it's well hidden, but true. So IMHO worth a comment.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver
Date: Sun, 23 Nov 2014 18:52:00 +0000 [thread overview]
Message-ID: <20141123185200.GD4431@pengutronix.de> (raw)
In-Reply-To: <20141122181406.GC9698@katana>
Hallo Wolfram,
On Sat, Nov 22, 2014 at 07:14:06PM +0100, Wolfram Sang wrote:
> > > > + case I2C_SLAVE_REQ_READ_END:
> > > > + eeprom->buffer_idx++;
> > > You don't check here for buffer_idx >= ARRAY_SIZE(buffer)?
> > > Ditto in the I2C_SLAVE_REQ_WRITE_END case.
> > I just noticed that buffer_idx is an u8, so it overflows at 255+1. So
> > the probe routine should error out if size is bigger than 256.
>
> But size is currently fixed to 256, so all is fine. Yes, if we extend it
> for bigger sizes, all that stuff needs to be taken care of, right.
yeah, it's well hidden, but true. So IMHO worth a comment.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
WARNING: multiple messages have this Message-ID (diff)
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver
Date: Sun, 23 Nov 2014 19:52:00 +0100 [thread overview]
Message-ID: <20141123185200.GD4431@pengutronix.de> (raw)
In-Reply-To: <20141122181406.GC9698@katana>
Hallo Wolfram,
On Sat, Nov 22, 2014 at 07:14:06PM +0100, Wolfram Sang wrote:
> > > > + case I2C_SLAVE_REQ_READ_END:
> > > > + eeprom->buffer_idx++;
> > > You don't check here for buffer_idx >= ARRAY_SIZE(buffer)?
> > > Ditto in the I2C_SLAVE_REQ_WRITE_END case.
> > I just noticed that buffer_idx is an u8, so it overflows at 255+1. So
> > the probe routine should error out if size is bigger than 256.
>
> But size is currently fixed to 256, so all is fine. Yes, if we extend it
> for bigger sizes, all that stuff needs to be taken care of, right.
yeah, it's well hidden, but true. So IMHO worth a comment.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org, linux-sh@vger.kernel.org,
Magnus Damm <magnus.damm@gmail.com>,
linux-kernel@vger.kernel.org, Jean Delvare <jdelvare@suse.de>,
Simon Horman <horms@verge.net.au>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver
Date: Sun, 23 Nov 2014 19:52:00 +0100 [thread overview]
Message-ID: <20141123185200.GD4431@pengutronix.de> (raw)
In-Reply-To: <20141122181406.GC9698@katana>
Hallo Wolfram,
On Sat, Nov 22, 2014 at 07:14:06PM +0100, Wolfram Sang wrote:
> > > > + case I2C_SLAVE_REQ_READ_END:
> > > > + eeprom->buffer_idx++;
> > > You don't check here for buffer_idx >= ARRAY_SIZE(buffer)?
> > > Ditto in the I2C_SLAVE_REQ_WRITE_END case.
> > I just noticed that buffer_idx is an u8, so it overflows at 255+1. So
> > the probe routine should error out if size is bigger than 256.
>
> But size is currently fixed to 256, so all is fine. Yes, if we extend it
> for bigger sizes, all that stuff needs to be taken care of, right.
yeah, it's well hidden, but true. So IMHO worth a comment.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2014-11-23 18:52 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 16:04 [PATCH 0/3] i2c: slave support framework for Linux devices Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
[not found] ` <1416326695-13083-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2014-11-18 16:04 ` [PATCH 1/3] i2c: core changes for slave support Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
2014-11-18 16:04 ` [PATCH 3/3] i2c: rcar: add " Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
2014-11-18 16:04 ` [PATCH 2/3] i2c: slave-eeprom: add eeprom simulator driver Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
2014-11-18 16:04 ` Wolfram Sang
2014-11-20 22:39 ` Stijn Devriendt
2014-11-20 22:39 ` Stijn Devriendt
2014-11-20 22:39 ` Stijn Devriendt
2014-11-22 18:12 ` Wolfram Sang
2014-11-22 18:12 ` Wolfram Sang
2014-11-22 18:12 ` Wolfram Sang
2014-11-25 22:07 ` Stijn Devriendt
2014-11-25 22:07 ` Stijn Devriendt
2014-11-25 22:07 ` Stijn Devriendt
2014-11-25 22:07 ` Stijn Devriendt
2014-11-26 12:22 ` Wolfram Sang
2014-11-26 12:22 ` Wolfram Sang
2014-11-26 12:22 ` Wolfram Sang
2014-11-26 12:25 ` Alexander Kochetkov
2014-11-26 12:25 ` Alexander Kochetkov
2014-11-26 12:25 ` Alexander Kochetkov
[not found] ` <2A7C987F-15E0-46FD-A711-E7F5BA9893FC-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-26 12:49 ` Wolfram Sang
2014-11-26 12:49 ` Wolfram Sang
2014-11-26 12:49 ` Wolfram Sang
2014-11-26 12:49 ` Wolfram Sang
2014-11-21 7:19 ` Uwe Kleine-König
2014-11-21 7:19 ` Uwe Kleine-König
2014-11-21 7:19 ` Uwe Kleine-König
[not found] ` <20141121071941.GK27002-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-21 14:16 ` Uwe Kleine-König
2014-11-21 14:16 ` Uwe Kleine-König
2014-11-21 14:16 ` Uwe Kleine-König
2014-11-21 14:16 ` Uwe Kleine-König
2014-11-22 18:14 ` Wolfram Sang
2014-11-22 18:14 ` Wolfram Sang
2014-11-22 18:14 ` Wolfram Sang
2014-11-23 18:52 ` Uwe Kleine-König [this message]
2014-11-23 18:52 ` Uwe Kleine-König
2014-11-23 18:52 ` Uwe Kleine-König
2014-11-23 18:52 ` Uwe Kleine-König
2014-11-22 18:26 ` Wolfram Sang
2014-11-22 18:26 ` Wolfram Sang
2014-11-22 18:26 ` Wolfram Sang
2014-11-22 18:26 ` Wolfram Sang
2014-11-23 20:20 ` Uwe Kleine-König
2014-11-23 20:20 ` Uwe Kleine-König
2014-11-23 20:20 ` Uwe Kleine-König
2014-11-23 20:20 ` Uwe Kleine-König
[not found] ` <20141123202008.GE4431-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-11-24 20:40 ` Wolfram Sang
2014-11-24 20:40 ` Wolfram Sang
2014-11-24 20:40 ` Wolfram Sang
2014-11-24 20:40 ` Wolfram Sang
2014-12-11 21:26 ` [PATCH 0/3] i2c: slave support framework for Linux devices Wolfram Sang
2014-12-11 21:26 ` Wolfram Sang
2014-12-11 21:26 ` Wolfram Sang
2014-12-11 21:26 ` Wolfram Sang
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=20141123185200.GD4431@pengutronix.de \
--to=u.kleine-koenig-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
--cc=horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org \
--cc=jdelvare-l3A5Bk7waGM@public.gmane.org \
--cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.