[PATCH][RT] Trivial: Correctly dereference when clearing unusedvariable

From: Sven-Thorsten Dietrich
Date: Fri Nov 07 2008 - 16:25:28 EST




From: Sven-Thorsten Dietrich <sdietrich@xxxxxxx>
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.

Signed-off-by: Sven-Thorsten Dietrich <sdietrich@xxxxxxx>

---
mm/page_alloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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();


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/