[PATCH] arm64: kexec: Initialize kexec_buf struct in image_load()

Pratyush Yadav pratyush at kernel.org
Tue Aug 26 05:54:02 PDT 2025


On Tue, Aug 26 2025, Breno Leitao wrote:

> The kexec_buf structure was previously declared without initialization
> in image_load(). This led to a UBSAN warning when the structure was
> expanded and uninitialized fields were accessed [1].
>
> Zero-initializing kexec_buf at declaration ensures all fields are
> cleanly set, preventing future instances of uninitialized memory being
> used.
>
> Andrew Morton suggested that this function is only called 3x a week[2],
> thus, the memset() cost is inexpressive.

Yep, and it is only 80 bytes on an already very expensive kexec load
call.

>
> Link: https://lore.kernel.org/all/oninomspajhxp4omtdapxnckxydbk2nzmrix7rggmpukpnzadw@c67o7njgdgm3/ [1]
> Link: https://lore.kernel.org/all/20250825180531.94bfb86a26a43127c0a1296f@linux-foundation.org/ [2]
> Suggested-by: Andrew Morton <akpm at linux-foundation.org>
> Signed-off-by: Breno Leitao <leitao at debian.org>

Reviewed-by: Pratyush Yadav <pratyush at kernel.org>

[...]

-- 
Regards,
Pratyush Yadav



More information about the linux-arm-kernel mailing list