Skip to content

Commit 700d686

Browse files
arndboupton
authored andcommitted
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: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20250807072132.4170088-1-arnd@kernel.org Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent 69f8fe9 commit 700d686

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/arm64/kvm/hyp/nvhe/list_debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static inline __must_check bool nvhe_check_data_corruption(bool v)
1717
bool corruption = unlikely(condition); \
1818
if (corruption) { \
1919
if (IS_ENABLED(CONFIG_BUG_ON_DATA_CORRUPTION)) { \
20-
BUG_ON(1); \
20+
BUG(); \
2121
} else \
2222
WARN_ON(1); \
2323
} \

arch/arm64/kvm/vgic/vgic-mmio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ int vgic_register_dist_iodev(struct kvm *kvm, gpa_t dist_base_address,
10911091
len = vgic_v3_init_dist_iodev(io_device);
10921092
break;
10931093
default:
1094-
BUG_ON(1);
1094+
BUG();
10951095
}
10961096

10971097
io_device->base_addr = dist_base_address;

0 commit comments

Comments
 (0)