Skip to content

Commit 4c3677c

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/percpu: Fix x86_this_cpu_variable_test_bit() asm template
Fix x86_this_cpu_variable_test_bit(), which is implemented with an incorrect asm template, where argument 2 (count argument) is considered a percpu variable. However, x86_this_cpu_test_bit() is currently used exclusively with constant bit number argument, so the called x86_this_cpu_variable_test_bit() function is never instantiated. The fix introduces named assembler operands to prevent this kind of error. Signed-off-by: Uros Bizjak <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9ebe550 commit 4c3677c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/x86/include/asm/percpu.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,10 +586,11 @@ static inline bool x86_this_cpu_variable_test_bit(int nr,
586586
{
587587
bool oldbit;
588588

589-
asm volatile("btl "__percpu_arg(2)",%1"
589+
asm volatile("btl %[nr], " __percpu_arg([var])
590590
CC_SET(c)
591591
: CC_OUT(c) (oldbit)
592-
: "m" (*__my_cpu_ptr((unsigned long __percpu *)(addr))), "Ir" (nr));
592+
: [var] "m" (*__my_cpu_ptr((unsigned long __percpu *)(addr))),
593+
[nr] "Ir" (nr));
593594

594595
return oldbit;
595596
}

0 commit comments

Comments
 (0)