[PATCH] Add error checking to slram

Josh Boyer jdub at us.ibm.com
Mon Jan 10 09:41:15 EST 2005


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:
> > 
> > The following patch fixes a couple issues I saw with the slram driver.
> > 
> > 1) No error checking was being done at all.
> > 
> > 2) There was no eraseblock size for slram, which made JFFS2 unhappy.
> 
> Had a look at that one and imo it's jffs2 that should get fixed.  But
> for the moment, your patch is fine.

No argument from me there.  I've been sitting on this patch for a long
time and it was simply the easiest fix.  Until JFFS2 gets fixed, this
should suffice.

> > Please take a look at the patch and commit if it looks good.  Comments
> > are always welcome too :).
> 
> Just one, rest looks fine to me.

<snip>

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

josh





More information about the linux-mtd mailing list