From: Nathan Chancellor <nathan@kernel.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>,
Oliver Upton <oliver.upton@linux.dev>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] kvm: arm64: use BUG() instead of BUG_ON(1)
Date: Thu, 7 Aug 2025 08:56:26 -0700 [thread overview]
Message-ID: <20250807155626.GA2145434@ax162> (raw)
In-Reply-To: <20250807072132.4170088-1-arnd@kernel.org>
On Thu, Aug 07, 2025 at 09:21:28AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The BUG_ON() macro adds a little bit of complexity over BUG(), and in
> some cases this ends up confusing the compiler's control flow analysis
> in a way that results in a warning. This one now shows up with clang-21:
>
> arch/arm64/kvm/vgic/vgic-mmio.c:1094:3: error: variable 'len' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> 1094 | BUG_ON(1);
>
> Change both instances of BUG_ON(1) to a plain BUG() in the arm64 kvm
> code, to avoid the false-positive warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Yeah I had responded to a build report around this but I never followed
up on seeing if it got fixed.
https://lore.kernel.org/20250714171559.GA1364710@ax162/
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
> arch/arm64/kvm/hyp/nvhe/list_debug.c | 2 +-
> arch/arm64/kvm/vgic/vgic-mmio.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kvm/hyp/nvhe/list_debug.c b/arch/arm64/kvm/hyp/nvhe/list_debug.c
> index 46a2d4f2b3c6..baa6260f88dc 100644
> --- a/arch/arm64/kvm/hyp/nvhe/list_debug.c
> +++ b/arch/arm64/kvm/hyp/nvhe/list_debug.c
> @@ -17,7 +17,7 @@ static inline __must_check bool nvhe_check_data_corruption(bool v)
> bool corruption = unlikely(condition); \
> if (corruption) { \
> if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) { \
> - BUG_ON(1); \
> + BUG(); \
> } else \
> WARN_ON(1); \
> } \
> diff --git a/arch/arm64/kvm/vgic/vgic-mmio.c b/arch/arm64/kvm/vgic/vgic-mmio.c
> index e416e433baff..a573b1f0c6cb 100644
> --- a/arch/arm64/kvm/vgic/vgic-mmio.c
> +++ b/arch/arm64/kvm/vgic/vgic-mmio.c
> @@ -1091,7 +1091,7 @@ int vgic_register_dist_iodev(struct kvm *kvm, gpa_t dist_base_address,
> len = vgic_v3_init_dist_iodev(io_device);
> break;
> default:
> - BUG_ON(1);
> + BUG();
> }
>
> io_device->base_addr = dist_base_address;
> --
> 2.39.5
>
>
next prev parent reply other threads:[~2025-08-07 15:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 7:21 [PATCH] kvm: arm64: use BUG() instead of BUG_ON(1) Arnd Bergmann
2025-08-07 15:56 ` Nathan Chancellor [this message]
2025-08-08 17:51 ` Oliver Upton
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=20250807155626.GA2145434@ax162 \
--to=nathan@kernel.org \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=joey.gouly@arm.com \
--cc=justinstitt@google.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=morbo@google.com \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=oliver.upton@linux.dev \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--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.