]> Gentwo Git Trees - linux/.git/commit
LoongArch: kexec: Initialize the kexec_buf structure
authorYouling Tang <tangyouling@kylinos.cn>
Sun, 9 Nov 2025 08:02:01 +0000 (16:02 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Mon, 10 Nov 2025 00:37:07 +0000 (08:37 +0800)
commitdf16b8956cae970027f4be4a1500272201e2d5c1
treed7121ae60ba2fac6a2864c542eec721636c2e629
parenteeeeaafa62ea0cd4b86390f657dc0aea73bff4f5
LoongArch: kexec: Initialize the kexec_buf structure

The kexec_buf structure was previously declared without initialization.
commit bf454ec31add ("kexec_file: allow to place kexec_buf randomly")
added a field that is always read but not consistently populated by all
architectures. This un-initialized field will contain garbage.

This is also triggering a UBSAN warning when the uninitialized data is
accessed:

        ------------[ cut here ]------------
        UBSAN: invalid-load in ./include/linux/kexec.h:210:10
        load of value 252 is not a valid value for type '_Bool'

Zero-initializing kexec_buf at declaration ensures all fields are
cleanly set, preventing future instances of uninitialized memory being
used.

Fixes: bf454ec31add ("kexec_file: allow to place kexec_buf randomly")
Link: https://lore.kernel.org/r/20250827-kbuf_all-v1-2-1df9882bb01a@debian.org
Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/kernel/kexec_efi.c
arch/loongarch/kernel/kexec_elf.c
arch/loongarch/kernel/machine_kexec_file.c