[PATCH] 2.6.14-rc5-mm1 net/ipv4/route.c: spin_unlock call fails to compile
From: John Bowler
Date: Fri Oct 28 2005 - 03:00:25 EST
The spin_unlock call which gets an rt_hash_lock_addr(i)
argument fails to compile on rc5-mm1 uniprocessor with
no CONFIG_DEBUG_SPINLOCK because, in mm1, the spin_unlock
macro expands to a statement of the form:
do { (void)&ptr->raw; } while (0)
and 'ptr' is 'NULL'. Since the expression is address-of
(therefore not evaluated as an r-value - i.e. no attempt
is made to load the non-existent raw, just take its address)
this expression is harmless.
The patch makes 'ptr' ((spinlock_t*)NULL), which the compiler
can compile (sizeof *ptr is 0 in the case - the spinlock_t
struct is empty - so the patch is particularly safe.)
The patch applies to both 2.6.14 and 2.6.14-rc5-mm1 (although
only the latter requires it.)
Signed-off-by: John Bowler <jbowler@xxxxxxx>
--- linux-2.6.14-rc5/net/ipv4/route.c 2005-10-26 08:37:20.752285410 -0700
+++ patched/net/ipv4/route.c 2005-10-26 12:17:00.761651111 -0700
@@ -231,7 +231,7 @@ static spinlock_t *rt_hash_locks;
spin_lock_init(&rt_hash_locks[i]); \
}
#else
-# define rt_hash_lock_addr(slot) NULL
+# define rt_hash_lock_addr(slot) ((spinlock_t*)NULL)
# define rt_hash_lock_init()
#endif
-
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/