[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <531dba90-247e-481a-a26b-2dc9e7927d6d@kernel.org>
Date: Sat, 22 Nov 2025 15:25:20 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Ally Heev <allyheev@...il.com>, David Howells <dhowells@...hat.com>,
Lukas Wunner <lukas@...ner.de>, Ignat Korchagin <ignat@...udflare.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>
Cc: keyrings@...r.kernel.org, linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org, Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [PATCH v2] crypto: asymmetric_keys: fix uninitialized pointers
with free attribute
On 11/11/2025 14:36, Ally Heev wrote:
> Uninitialized pointers with `__free` attribute can cause undefined
> behavior as the memory assigned randomly to the pointer is freed
> automatically when the pointer goes out of scope.
>
> crypto/asymmetric_keys doesn't have any bugs related to this as of now,
> but, it is better to initialize and assign pointers with `__free`
> attribute in one statement to ensure proper scope-based cleanup
>
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Closes: https://lore.kernel.org/all/aPiG_F5EBQUjZqsl@stanley.mountain/
> Signed-off-by: Ally Heev <allyheev@...il.com>
> ---
> Changes in v2:
> - moved declarations to the top and initialized them with NULL
Why? This is not the syntax we want for cleanup.h. Either initialize it
with proper constructor or don't use cleanup.h.
Best regards,
Krzysztof
Powered by blists - more mailing lists