linux-6.19-rc4/kernel/kexec_core.c:425: Possible loss of data ?
David Binderman
dcb314 at hotmail.com
Wed Jan 7 06:32:05 PST 2026
Hello there,
Static analyser cppcheck says:
linux-6.19-rc4/kernel/kexec_core.c:425:7: style: int result is assigned to long variable. If the variable is long to avoid loss of information, then you have loss of information. [truncLongCastAssignment]
Source code is
size = (1 << order) << PAGE_SHIFT;
I have no idea how large order gets, but if it gets over about
30 or so, then IMHO there will be a loss of bits.
Perhaps some sanity check on the value of order would
be a good idea ? Either that or
size = (1UL << order) << PAGE_SHIFT;
might be better code.
Regards
David Binderman
More information about the kexec
mailing list