Skip to contentSkip to conversation

Trivial: Correctly dereference when clearing unused variable

PATCH New Sven-Thorsten Dietrich 1 participant 1 message Nov 7, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Trivial: Correctly dereference when clearing unused variable

From: Sven-Thorsten Dietrich <[email protected]>
Subject: Correctly dereference flags when clearing unused variable.

Its probably unsafe to set the flags pointer to 0, since this will oops, if it is dereferenced elsewhere for some odd reason.

---
 mm/page_alloc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/page_alloc.c +2 -2
@@ -170,7 +170,7 @@ static inline void __lock_cpu_pcp(unsign
 {
 #ifdef CONFIG_PREEMPT_RT
 	spin_lock(&__get_cpu_lock(pcp_locks, cpu));
-	flags = 0;
+	*flags = 0;
 #else
 	local_irq_save(*flags);
 #endif
@@ -180,7 +180,7 @@ static inline void lock_cpu_pcp(unsigned
 {
 #ifdef CONFIG_PREEMPT_RT
 	(void)get_cpu_var_locked(pcp_locks, this_cpu);
-	flags = 0;
+	*flags = 0;
 #else
 	local_irq_save(*flags);
 	*this_cpu = smp_processor_id();