[PATCH 1/2] mtdpart: Avoid divide-by-zero on out-of-reach path
Jörn Engel
joern at logfs.org
Thu Jun 19 04:24:54 EDT 2008
On Thu, 19 June 2008 16:09:38 +0900, Atsushi Nemoto wrote:
> On Wed, 18 Jun 2008 19:52:53 +0200, Jörn Engel <joern at logfs.org> wrote:
>
> > + err = add_one_partition(master, parts + i, i, cur_offset);
> > + if (err)
> > + return err;
> > + slave = PART(parts[i].mtdp);
> > + cur_offset = slave->offset + slave->mtd.size;
>
> This should be 'slave = PART(*parts[i].mtdp)', but anyway you cannot
> dereference mtdp while it can be NULL.
>
> Other parts of your patchset are very good for me. Thanks.
>
> This is my quick fix on top of your patchset. Please fold this (or
> your own fix) into first patch.
Much better. I was thinking about the same thing while doing the
patches, but for some reason forgot about it again.
Do you want me to push the patchset? And would you be willing to add a
tested-by: or so?
Jörn
--
The key to performance is elegance, not battalions of special cases.
-- Jon Bentley and Doug McIlroy
More information about the linux-mtd
mailing list