lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <396b2d11-29ca-4fae-97c3-7280c879cbfd@web.de>
Date: Fri, 7 Nov 2025 08:00:51 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Liyuan Pang <pangliyuan1@...wei.com>, linux-mtd@...ts.infradead.org,
 linux-arm-kernel@...ts.infradead.org,
 linux-stm32@...md-mailman.stormreply.com,
 Alexandre Torgue <alexandre.torgue@...s.st.com>,
 Maxime Coquelin <mcoquelin.stm32@...il.com>,
 Miquel Raynal <miquel.raynal@...tlin.com>,
 Richard Weinberger <richard@....at>, Vignesh Raghavendra <vigneshr@...com>,
 wanqian10@...wei.com, Yang Liu <young.liuyang@...wei.com>,
 Zhihao Cheng <chengzhihao1@...wei.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ubi: fastmap: fix ubi->fm memory leak

>> …
>>> +++ 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.

Would you support to reduce the scope for such a variable to
the code block of the if branch?

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ