Skip to contentSkip to conversation

get_cpu_var must be an lvalue

PATCH New Rusty Russell 1 participant 1 message Sep 12, 2002 Per-CPU memory allocator

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 get_cpu_var must be an lvalue

Linus, please apply.

Name: get_per_cpu lvalue fix
Author: Rusty Russell
Status: Trivial

D: get_cpu_var(var) should be an lvalue. Spotted by Dipankar Sarma.

include/linux/percpu.h +2 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.32/include/linux/percpu.h working-2.5.32-percpu/include/linux/percpu.h
@@ -3,7 +3,8 @@
 #include <linux/spinlock.h> /* For preempt_disable() */
 #include <asm/percpu.h>
 
-#define get_cpu_var(var) ({ preempt_disable(); __get_cpu_var(var); })
+/* Must be an lvalue. */
+#define get_cpu_var(var) (*({ preempt_disable(); &__get_cpu_var(var); }))
 #define put_cpu_var(var) preempt_enable()
 
 #endif /* __LINUX_PERCPU_H */

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.