]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kvm: arm64: use BUG() instead of BUG_ON(1)
authorArnd Bergmann <arnd@arndb.de>
Thu, 7 Aug 2025 07:21:28 +0000 (09:21 +0200)
committerOliver Upton <oliver.upton@linux.dev>
Fri, 8 Aug 2025 08:28:57 +0000 (01:28 -0700)
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>
arch/arm64/kvm/hyp/nvhe/list_debug.c
arch/arm64/kvm/vgic/vgic-mmio.c

index 46a2d4f2b3c6ef724625ca73e865729cc7b59f8c..baa6260f88dc13762c0e1f16870a64903d4c8e19 100644 (file)
@@ -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);                              \
                }                                                        \
index e416e433baff3ea5f8d743843e141374316bdf96..a573b1f0c6cbeee347aa50426d37ddb018d741c2 100644 (file)
@@ -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;