linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pratyush Yadav <pratyush@kernel.org>
To: David Binderman <dcb314@hotmail.com>
Cc: "graf@amazon.com" <graf@amazon.com>,
	 "rppt@kernel.org" <rppt@kernel.org>,
	 "pasha.tatashin@soleen.com" <pasha.tatashin@soleen.com>,
	 "pratyush@kernel.org" <pratyush@kernel.org>,
	"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	 LKML <linux-kernel@vger.kernel.org>
Subject: Re: linux-6.19-rc8/kernel/liveupdate/kexec_handover.c:1089: Possible 32/64 bit mixup ?
Date: Tue, 10 Feb 2026 14:41:05 +0100	[thread overview]
Message-ID: <2vxzzf5gsolq.fsf@kernel.org> (raw)
In-Reply-To: <VI1PR02MB3952964EF347629B2686A36E9C99A@VI1PR02MB3952.eurprd02.prod.outlook.com> (David Binderman's message of "Thu, 5 Feb 2026 09:21:17 +0000")

Hi David,

On Thu, Feb 05 2026, David Binderman wrote:

> Hello there,
>
> Source code analyser cppcheck says:
>
> linux-6.19-rc8/kernel/liveupdate/kexec_handover.c:1089:15: 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
>
>     contig_pages = (1 << order);
>
> I admit the error message is hard to understand, but AFAIK
> if local variable order remains under 30 or so, then there is no problem.
>
> However, if it goes above 32, then there will be loss of data. 
> Expression 1 << order is type int.
>
> Suggest add some code or comment to document the expected range
> of local variable order. If it ever goes above 32, suggest new code
>
>     contig_pages = 1UL << order;

If order is 32, with 4k pages, that means 16 TiB. It is unlikely that we
will see vmalloc area backed by pages this large any time soon. So I am
not worried about any practical problems.

But I think this is still a good idea to do for code hygiene. So a patch
would be much appreciated.

-- 
Regards,
Pratyush Yadav


      reply	other threads:[~2026-02-10 13:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05  9:21 David Binderman
2026-02-10 13:41 ` Pratyush Yadav [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2vxzzf5gsolq.fsf@kernel.org \
    --to=pratyush@kernel.org \
    --cc=dcb314@hotmail.com \
    --cc=graf@amazon.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox