Re: [PATCH 1/6] mtd: afs: simplify partition parsing

Boris Brezillon
2019-01-31T17:45:25Z

Hi Liviu,

On Thu, 31 Jan 2019 17:13:27 +0000
Liviu Dudau <liviu.dudau@arm.com> wrote:

> Hi Linus,
>
> On Mon, Jan 28, 2019 at 02:54:44PM +0100, Linus Walleij wrote:
> > This simplifies the AFS partition parsing to make the code
> > more straight-forward and readable.
> >
> > Before this patch the code tried to calculate the memory required
> > to hold the partition info by adding up the sizes of the strings
> > of the names and adding that to a single memory allocation,
> > indexing the name pointers in front of the struct mtd_partition
> > allocations so all allocated data was in one chunk.
> >
> > This is overzealous. Instead use kstrdup and bail out,
> > kfree():ing the memory used for MTD partitions and names alike
> > on the errorpath.
> >
> > In the process rename the index variable from idx to i.
> >
> > Cc: Ryan Harkin <ryan.harkin@linaro.org>
> > Cc: Liviu Dudau <liviu.dudau@arm.com>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > ---
> > drivers/mtd/parsers/afs.c | 67 +++++++++++++++++++--------------------
>
> What kernel is this series based on? Current Torvalds' tree has the
> afs.c file in drivers/mtd and not in drivers/mtd/parsers/. Is there a
> patch that I'm missing moving things around?

It depends on this series [1] (mentioned in the cover letter).

Regards,

Boris

[1]http://patchwork.ozlabs.org/project/linux-mtd/list/?series=87760