From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.bootlin.com ([62.4.15.54]:34139 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727979AbeK2BnQ (ORCPT ); Wed, 28 Nov 2018 20:43:16 -0500 Date: Wed, 28 Nov 2018 15:41:04 +0100 From: Boris Brezillon To: Schrempf Frieder Cc: Miquel Raynal , Richard Weinberger , "stable@vger.kernel.org" , David Woodhouse , Brian Norris , Marek Vasut , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] mtd: nand: Fix memory allocation in nanddev_bbt_init() Message-ID: <20181128154104.577d5923@bbrezillon> In-Reply-To: <1543304637-27308-1-git-send-email-frieder.schrempf@kontron.de> References: <1543304637-27308-1-git-send-email-frieder.schrempf@kontron.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On Tue, 27 Nov 2018 07:44:52 +0000 Schrempf Frieder 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. > > Fixes: 9c3736a3de21 ("mtd: nand: Add core infrastructure to deal with NAND devices") > Cc: > Signed-off-by: Frieder Schrempf Looks like your From header does not match the SoB tag ('Frieder Schrempf' vs 'Schrempf Frieder') and checkpatch does not like that. I'll fix it when applying, but maybe you should fix your .gitconfig to make them match. > --- > 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), > + GFP_KERNEL); > if (!nand->bbt.cache) > return -ENOMEM; >