mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* linux-6.19-rc4/kernel/kexec_core.c:425: Possible loss of data ?
@ 2026-01-07 14:32 David Binderman
  2026-01-08  3:12 ` bhe
  0 siblings, 1 reply; 3+ messages in thread
From: David Binderman @ 2026-01-07 14:32 UTC (permalink / raw)
  To: akpm, bhe, kexec, LKML

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-08  8:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-07 14:32 linux-6.19-rc4/kernel/kexec_core.c:425: Possible loss of data ? David Binderman
2026-01-08  3:12 ` bhe
2026-01-08  8:42   ` David Binderman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®