Skip to content

Commit 6d0d8eb

Browse files
melveropsiff
authored andcommitted
kcsan: test: Initialize dummy variable
[ Upstream commit 9872916ad1a1a5e7d089e05166c85dbd65e5b0e8 ] Newer compiler versions rightfully point out: kernel/kcsan/kcsan_test.c:591:41: error: variable 'dummy' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer] 591 | KCSAN_EXPECT_READ_BARRIER(atomic_read(&dummy), false); | ^~~~~ 1 error generated. Although this particular test does not care about the value stored in the dummy atomic variable, let's silence the warning. Link: https://lkml.kernel.org/r/CA+G9fYu8JY=k-r0hnBRSkQQrFJ1Bz+ShdXNwC1TNeMt0eXaxeA@mail.gmail.com Fixes: 8bc32b3 ("kcsan: test: Add test cases for memory barrier instrumentation") Reported-by: Linux Kernel Functional Testing <[email protected]> Reviewed-by: Alexander Potapenko <[email protected]> Signed-off-by: Marco Elver <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit cdb509f59aaf0624bb6113cbb022968e2e1eda5a)
1 parent c578fa8 commit 6d0d8eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/kcsan/kcsan_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ static void test_barrier_nothreads(struct kunit *test)
530530
struct kcsan_scoped_access *reorder_access = NULL;
531531
#endif
532532
arch_spinlock_t arch_spinlock = __ARCH_SPIN_LOCK_UNLOCKED;
533-
atomic_t dummy;
533+
atomic_t dummy = ATOMIC_INIT(0);
534534

535535
KCSAN_TEST_REQUIRES(test, reorder_access != NULL);
536536
KCSAN_TEST_REQUIRES(test, IS_ENABLED(CONFIG_SMP));

0 commit comments

Comments
 (0)