Commit 700d6868 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Oliver Upton
Browse files

kvm: arm64: use BUG() instead of BUG_ON(1)



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: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250807072132.4170088-1-arnd@kernel.org


Signed-off-by: default avatarOliver Upton <oliver.upton@linux.dev>
parent 69f8fe95
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);				 \
		}							 \
+1 −1
Original line number Diff line number Diff line
@@ -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;