From: Liyuan Pang <pangliyuan1@huawei.com>
To: <markus.elfring@web.de>
Cc: <alexandre.torgue@foss.st.com>, <chengzhihao1@huawei.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<mcoquelin.stm32@gmail.com>, <miquel.raynal@bootlin.com>,
<pangliyuan1@huawei.com>, <richard@nod.at>, <vigneshr@ti.com>,
<wanqian10@huawei.com>, <young.liuyang@huawei.com>
Subject: Re: [PATCH] ubi: fastmap: fix ubi->fm memory leak
Date: Fri, 7 Nov 2025 10:11:37 +0800 [thread overview]
Message-ID: <20251107021137.874150-1-pangliyuan1@huawei.com> (raw)
In-Reply-To: <dff05531-f5e3-400a-abf0-a5307c50357e@web.de>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="y", Size: 694 bytes --]
On Thu, 6 Nov 2025 16:16:05 +0100, Markus Elfring wrote:
>…
>> +++ b/drivers/mtd/ubi/fastmap.c
>> @@ -1644,3 +1644,15 @@ int ubi_update_fastmap(struct ubi_device *ubi)
>…
>> +void ubi_free_fastmap(struct ubi_device *ubi)
>> +{
>> + int i;
>> +
>> + if (ubi->fm) {
> + for (i = 0; i < ubi->fm->used_blocks; i++)
> + kmem_cache_free(ubi_wl_entry_slab, ubi->fm->e[i]);
>…
> + }
> +}
>…
>
> May the local variable “i” be defined in the loop header?
I think it's better to leave it as it is, most of the code in
ubi defines variables outside the loop header, and defining
"i" in the loop header may cause compilation error in some old
kernel versions that use C89.
Regards,
Liyuan
[-- Attachment #2: Type: text/plain, Size: 144 bytes --]
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2025-11-07 2:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 12:07 [PATCH] ubi: fastmap: fix ubi->fm memory leak Liyuan Pang
2025-11-06 15:16 ` Markus Elfring
2025-11-07 2:11 ` Liyuan Pang [this message]
2025-11-07 7:00 ` Markus Elfring
2025-11-07 9:38 ` Liyuan Pang
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=20251107021137.874150-1-pangliyuan1@huawei.com \
--to=pangliyuan1@huawei.com \
--cc=alexandre.torgue@foss.st.com \
--cc=chengzhihao1@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=markus.elfring@web.de \
--cc=mcoquelin.stm32@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
--cc=wanqian10@huawei.com \
--cc=young.liuyang@huawei.com \
/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