[PATCH RESEND] mtdpart: Avoid divide-by-zero on out-of-reach path

Atsushi Nemoto anemo at mba.ocn.ne.jp
Mon Jun 16 10:30:39 EDT 2008


On Mon, 16 Jun 2008 10:33:56 +0200, Jörn Engel <joern at logfs.org> wrote:
> > On "partition is out of reach" path, i.e. slave's offset was bigger
> > than the master's size, slave's erasesize will not be calculated and
> > it leads division by zero on following boundary checking.  This patch
> > makes calculation of the slave's erasesize more robust.
> > 
> > This patch also contains some cleanups.  Do not shadow symbol 'i',
> > fold long lines, etc.
> 
> I personally consider the original long "for (...)" lines slightly
> better (or rather less bad) than your replacement.  Mixing cleanups
> with bugfixes is often a bad idea.
> 
> Another reason is that I still cannot see the bugfix among all the
> changes. *scratches head*  Ah, here it is.  *scratches some more*  And
> it even appears to be correct.
> 
> Can you resend as two patches?

OK, I will send two patches --- one for the bugfix and one for sparse
warning.  Remaining cleanup ("Folding long lines, etc.") was just for
checkpatch.pl and if these new patches can be accepted, I gladly keep
code as is.  The mtdpart.c has many long lines anyway. :-)

Thank you for review.

---
Atsushi Nemoto



More information about the linux-mtd mailing list