[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9365718c-4993-7e3b-1519-8fef0c08c0db@kontron.de>
Date: Tue, 27 Nov 2018 08:30:24 +0000
From: Schrempf Frieder <frieder.schrempf@...tron.de>
To: Boris Brezillon <boris.brezillon@...tlin.com>
CC: Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
"stable@...r.kernel.org" <stable@...r.kernel.org>,
"David Woodhouse" <dwmw2@...radead.org>,
Brian Norris <computersforpeace@...il.com>,
Marek Vasut <marek.vasut@...il.com>,
"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mtd: nand: Fix memory allocation in nanddev_bbt_init()
On 27.11.18 09:22, Boris Brezillon wrote:
> On Tue, 27 Nov 2018 07:44:52 +0000
> Schrempf Frieder <frieder.schrempf@...tron.de> wrote:
>
>> Fix the size of the buffer allocated to store the in-memory BBT.
>> This bug was previously hidden by a different bug, that was fixed in
>> d098093ba06e.
>
> Oops :-/.
>
>>
>> Fixes: 9c3736a3de21 ("mtd: nand: Add core infrastructure to deal with NAND devices")
>> Cc: <stable@...r.kernel.org>
>> Signed-off-by: Frieder Schrempf <frieder.schrempf@...tron.de>
>> ---
>> drivers/mtd/nand/bbt.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c
>> index 56cde38..c12497f 100644
>> --- a/drivers/mtd/nand/bbt.c
>> +++ b/drivers/mtd/nand/bbt.c
>> @@ -27,7 +27,8 @@ int nanddev_bbt_init(struct nand_device *nand)
>> unsigned int nwords = DIV_ROUND_UP(nblocks * bits_per_block,
>> BITS_PER_LONG);
>>
>> - nand->bbt.cache = kzalloc(nwords, GFP_KERNEL);
>> + nand->bbt.cache = kzalloc(nwords * (BITS_PER_LONG / BITS_PER_BYTE),
>
> I prefer
>
> * sizeof(*nand->bbt.cache)
> If you're okay with this change, I'll fix it when applying (no need to
> send a new version).
Sure, that's ok.
Powered by blists - more mailing lists