From: <Tudor.Ambarus@microchip.com>
To: <wenwen@cs.uga.edu>
Cc: <marek.vasut@gmail.com>, <dwmw2@infradead.org>,
<computersforpeace@gmail.com>, <miquel.raynal@bootlin.com>,
<richard@nod.at>, <vigneshr@ti.com>,
<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mtd: spi-nor: fix a memory leak bug
Date: Mon, 19 Aug 2019 06:03:26 +0000 [thread overview]
Message-ID: <e52a548a-0516-55ee-4005-5cc24c3a20b5@microchip.com> (raw)
In-Reply-To: <1566149993-2748-1-git-send-email-wenwen@cs.uga.edu>
On 08/18/2019 08:39 PM, Wenwen Wang wrote:
> In spi_nor_parse_4bait(), 'dwords' is allocated through kmalloc(). However,
> it is not deallocated in the following execution if spi_nor_read_sfdp()
> fails, leading to a memory leak. To fix this issue, free 'dwords' before
> returning the error.
Looks good. Would you add a Fixes tag?
>
> Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
> ---
> drivers/mtd/spi-nor/spi-nor.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index 03cc788..a41a466 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -3453,7 +3453,7 @@ static int spi_nor_parse_4bait(struct spi_nor *nor,
> addr = SFDP_PARAM_HEADER_PTP(param_header);
> ret = spi_nor_read_sfdp(nor, addr, len, dwords);
> if (ret)
> - return ret;
> + goto out;
>
> /* Fix endianness of the 4BAIT DWORDs. */
> for (i = 0; i < SFDP_4BAIT_DWORD_MAX; i++)
>
next prev parent reply other threads:[~2019-08-19 6:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-18 17:39 Wenwen Wang
2019-08-19 6:03 ` Tudor.Ambarus [this message]
2019-08-19 17:03 ` Wenwen Wang
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=e52a548a-0516-55ee-4005-5cc24c3a20b5@microchip.com \
--to=tudor.ambarus@microchip.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--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=vigneshr@ti.com \
--cc=wenwen@cs.uga.edu \
/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
all inboxes | Powered by JetHome®