Netdev List
 help / color / mirror / Atom feed
From: John Bowler <jbowler@acm.org>
To: <netdev@vger.kernel.org>
Cc: <mingo@elte.hu>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2.6.14-rc5-mm1 net/ipv4/route.c: spin_unlock call fails to compile
Date: Fri, 28 Oct 2005 00:08:26 -0700	[thread overview]
Message-ID: <001401c5db8e$650bd380$1001a8c0@kalmiopsis> (raw)

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@acm.org>

--- 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
 

             reply	other threads:[~2005-10-28  7:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-28  7:08 John Bowler [this message]
2005-10-28  9:00 ` [PATCH] 2.6.14-rc5-mm1 net/ipv4/route.c: spin_unlock call fails to compile Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001401c5db8e$650bd380$1001a8c0@kalmiopsis' \
    --to=jbowler@acm.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox