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] [day] [month] [year] [list]
Message-ID: <7ac7b17a-0cfa-44a9-bfe7-35792609e248@icloud.com>
Date: Sat, 11 Jan 2025 20:52:39 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
 Maxime Ripard <mripard@...nel.org>, Robin Murphy <robin.murphy@....com>,
 Grant Likely <grant.likely@...retlab.ca>, Marc Zyngier <maz@...nel.org>,
 Andreas Herrmann <andreas.herrmann@...xeda.com>,
 Marek Szyprowski <m.szyprowski@...sung.com>,
 Catalin Marinas <catalin.marinas@....com>, Mike Rapoport <rppt@...nel.org>,
 Oreoluwa Babatunde <quic_obabatun@...cinc.com>, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH v4 06/14] of: property: Avoiding using uninitialized
 variable @imaplen in parse_interrupt_map()

On 2025/1/11 17:01, Krzysztof Kozlowski wrote:
> On Sat, Jan 11, 2025 at 06:34:21AM +0800, Zijun Hu wrote:
>> On 2025/1/11 04:26, Rob Herring wrote:
>>> On Thu, Jan 09, 2025 at 09:26:57PM +0800, Zijun Hu wrote:
>>>> From: Zijun Hu <quic_zijuhu@...cinc.com>
>>>>
>>>> parse_interrupt_map() will use uninitialized variable @imaplen if fails
>>>> to get property 'interrupt-map'.
>>>>
>>>> Fix by using the variable after successfully getting the property.
>>>>
>>>> Fixes: e7985f43609c ("of: property: Fix fw_devlink handling of interrupt-map")
>>>> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
>>>> ---
>>>>  drivers/of/property.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/of/property.c b/drivers/of/property.c
>>>> index dca1a3ebccae1093b2b11f51e8e692bca854d0e3..6245cbff3527d762c16e7f4b7b7b3d4f2e9ddbe6 100644
>>>> --- a/drivers/of/property.c
>>>> +++ b/drivers/of/property.c
>>>> @@ -1391,9 +1391,9 @@ static struct device_node *parse_interrupt_map(struct device_node *np,
>>>>  	addrcells = of_bus_n_addr_cells(np);
>>>>  
>>>>  	imap = of_get_property(np, "interrupt-map", &imaplen);
>>>> -	imaplen /= sizeof(*imap);
>>>>  	if (!imap)
>>>>  		return NULL;
>>>> +	imaplen /= sizeof(*imap);
>>>
>>> sizeof() is a compile time constant, there's not an actual dereference 
>>> here.
>>>
>>
>> the uninitialized variable is @imaplen, and not sizeof(*imap).
> 
> Correct. I think error is harmless, because whatever stack/random value
> of imaplen we use in 'imaplen / =sizeof', we immediately return.
> 
> Anyway, for code correctness and silencing whatever warnings there are
> (if there are you should actually paste them in commit msg):
> 

thank you Krzysztof Kozlowski for code review.

no warning messages since this issue is found by reading code.

> Reviewed-by: Krzysztof Kozlowski <krzk@...nel.org>
> 
> Best regards,
> Krzysztof
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ