[PATCH v2] powerpc: 82xx: fix uninitialized pointers with free attribute

Krzysztof Kozlowski krzk at kernel.org
Sun Nov 23 00:03:16 AEDT 2025


On 16/11/2025 15:25, Ally Heev wrote:
> Uninitialized pointers with `__free` attribute can cause undefined
> behavior 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 at linaro.org>
> Closes: https://lore.kernel.org/all/aPiG_F5EBQUjZqsl@stanley.mountain/
> Signed-off-by: Ally Heev <allyheev at gmail.com>
> ---
> Changes in v2:
> - updated commit description
> - Link to v1: https://lore.kernel.org/r/20251104-aheev-uninitialized-free-attr-km82xx-v1-1-903be69f2cd4@gmail.com
> ---


This is the correct approach and the original patch should have never
been amended while applying.

Reviewed-by: Krzysztof Kozlowski <krzk at kernel.org>

Best regards,
Krzysztof


More information about the Linuxppc-dev mailing list