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

Jörn Engel joern at logfs.org
Mon Jun 16 04:33:56 EDT 2008


On Sat, 14 June 2008 23:45:40 +0900, Atsushi Nemoto 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?

Jörn

-- 
A victorious army first wins and then seeks battle.
-- Sun Tzu



More information about the linux-mtd mailing list