[PATCH] Add error checking to slram

Jörn Engel joern at wohnheim.fh-wedel.de
Mon Jan 10 09:55:41 EST 2005


On Mon, 10 January 2005 08:41:15 -0600, Josh Boyer wrote:
> On Sat, 2005-01-08 at 21:51 +0100, Jörn Engel wrote:
> > On Wed, 5 January 2005 15:50:32 -0600, Josh Boyer wrote:
> 
> > > +	if (from > mtd->size)
> > > +		return -EINVAL;
> > > +
> > > +	if (from + len > mtd->size)
> > > +		len = mtd->size - from;
> > > +
> > 
> > My code is slightly different:
> > 	if (len > mtd->size - from)
> > 		...
> > 
> > And yes, this _can_ make a difference. ;)
> 
> It's early and I haven't had my coffee yet :).  Care to educate me on
> why that makes a difference?

from = (uint32_t) -50;
len = 100;

Currently, I wouldn't dare creating a 4GiB mtd. ;)

Jörn

-- 
And spam is a useful source of entropy for /dev/random too!
-- Jasmine Strong




More information about the linux-mtd mailing list