From: Oliver Upton <oliver.upton@linux.dev>
To: David Binderman <dcb314@hotmail.com>
Cc: "maz@kernel.org" <maz@kernel.org>,
"joey.gouly@arm.com" <joey.gouly@arm.com>,
"suzuki.poulose@arm.com" <suzuki.poulose@arm.com>,
"yuzenghui@huawei.com" <yuzenghui@huawei.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"shuah@kernel.org" <shuah@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvmarm@lists.linux.dev" <kvmarm@lists.linux.dev>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kselftest@vger.kernel.org"
<linux-kselftest@vger.kernel.org>
Subject: Re: linux-6.15-rc2/tools/testing/selftests/kvm/lib/arm64/processor.c:107: Possible int/long mixup ?
Date: Mon, 14 Apr 2025 11:28:23 -0700 [thread overview]
Message-ID: <Z_1TxzniVGAS6gcp@linux.dev> (raw)
In-Reply-To: <AS8PR02MB10217FE659681FD584050156F9CB32@AS8PR02MB10217.eurprd02.prod.outlook.com>
On Mon, Apr 14, 2025 at 06:02:45PM +0000, David Binderman wrote:
> Hello there,
>
> Static analyser cppcheck says:
>
> linux-6.15-rc2/tools/testing/selftests/kvm/lib/arm64/processor.c:107:2: style: int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information. [truncLongCastReturn]
>
> Source code is
>
> return 1 << (vm->va_bits - shift);
>
> Maybe better code:
>
> return 1UL << (vm->va_bits - shift);
>
This expression is at most 8192 so there's no risk of truncation,
although the return type could potentially be improved.
Thanks,
Oliver
prev parent reply other threads:[~2025-04-14 18:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-14 18:02 linux-6.15-rc2/tools/testing/selftests/kvm/lib/arm64/processor.c:107: Possible int/long mixup ? David Binderman
2025-04-14 18:28 ` Oliver Upton [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=Z_1TxzniVGAS6gcp@linux.dev \
--to=oliver.upton@linux.dev \
--cc=dcb314@hotmail.com \
--cc=joey.gouly@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=maz@kernel.org \
--cc=pbonzini@redhat.com \
--cc=shuah@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.