From: Krzysztof Kozlowski <krzk@kernel.org>
To: Ally Heev <allyheev@gmail.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH] powerpc: 82xx: fix uninitialized pointers with free attr
Date: Wed, 5 Nov 2025 07:40:03 +0100 [thread overview]
Message-ID: <e6aad100-d338-4c51-9fa4-7a2415042b49@kernel.org> (raw)
In-Reply-To: <20251104-aheev-uninitialized-free-attr-km82xx-v1-1-903be69f2cd4@gmail.com>
On 04/11/2025 12:28, Ally Heev wrote:
> Uninitialized pointers with `__free` attribute can cause undefined
> behaviour as the memory allocated to the pointer is freed automatically
> when the pointer goes out of scope
>
> powerpc/km82xx 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@linaro.org>
> Closes: https://lore.kernel.org/all/aPiG_F5EBQUjZqsl@stanley.mountain/
> Signed-off-by: Ally Heev <allyheev@gmail.com>
> ---
> Testing:
> Successfully compiled the kernel with `allmodconfig`
> ---
> arch/powerpc/platforms/82xx/km82xx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/82xx/km82xx.c b/arch/powerpc/platforms/82xx/km82xx.c
> index 99f0f0f4187672614f4f8ad46ab7906f7ad8078b..4ad223525e893c0de15540db2b2c4d239d6d841e 100644
> --- a/arch/powerpc/platforms/82xx/km82xx.c
> +++ b/arch/powerpc/platforms/82xx/km82xx.c
> @@ -27,8 +27,8 @@
>
> static void __init km82xx_pic_init(void)
> {
> - struct device_node *np __free(device_node);
> - np = of_find_compatible_node(NULL, NULL, "fsl,pq2-pic");
> + struct device_node *np __free(device_node) = of_find_compatible_node(NULL,
> + NULL, "fsl,pq2-pic");
>
Original patch was correct:
https://lore.kernel.org/all/20240709143553.117053-1-david.hunter.linux@gmail.com/
It is the maintainer who decided to break it while applying, not
following clear cleanup.h recommendations and not giving a chance to
object to people. :/
So now we have a fixing commit.
Best regards,
Krzysztof
prev parent reply other threads:[~2025-11-05 6:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 11:28 Ally Heev
2025-11-05 6:40 ` Krzysztof Kozlowski [this message]
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=e6aad100-d338-4c51-9fa4-7a2415042b49@kernel.org \
--to=krzk@kernel.org \
--cc=allyheev@gmail.com \
--cc=christophe.leroy@csgroup.eu \
--cc=dan.carpenter@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.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
all inboxes | Powered by JetHome®