From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Schrempf Frieder <frieder.schrempf@kontron.de>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mtd: nand: Fix memory allocation in nanddev_bbt_init()
Date: Tue, 27 Nov 2018 09:22:32 +0100 [thread overview]
Message-ID: <20181127092232.3a6d1661@bbrezillon> (raw)
In-Reply-To: <1543304637-27308-1-git-send-email-frieder.schrempf@kontron.de>
On Tue, 27 Nov 2018 07:44:52 +0000
Schrempf Frieder <frieder.schrempf@kontron.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@vger.kernel.org>
> Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.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).
Thanks,
Boris
> + GFP_KERNEL);
> if (!nand->bbt.cache)
> return -ENOMEM;
>
next prev parent reply other threads:[~2018-11-27 8:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 7:44 [PATCH] mtd: nand: Fix memory allocation in nanddev_bbt_init() Schrempf Frieder
2018-11-27 8:22 ` Boris Brezillon [this message]
2018-11-27 8:30 ` Schrempf Frieder
2018-11-27 9:27 ` Miquel Raynal
2018-11-28 14:41 ` Boris Brezillon
2018-11-28 14:55 ` Schrempf Frieder
2018-11-28 15:02 ` Boris Brezillon
2018-11-28 15:19 ` Schrempf Frieder
2018-11-28 15:28 ` Boris Brezillon
2018-11-29 18:11 ` Schrempf Frieder
2018-11-30 9:37 ` Boris Brezillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181127092232.3a6d1661@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=frieder.schrempf@kontron.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).