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/ (local) [1]
Link: https://lore.kernel.org/all/20250825180531.94bfb86a26a43127c0a1296f@linux-foundation.org/ (local) [2]
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
[...]
--
Regards,
Pratyush Yadav