From: Eric Dumazet <eric.dumazet@gmail.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: shemminger@vyatta.com, davem@davemloft.net,
netdev@vger.kernel.org, bridge@lists.linux-foundation.org
Subject: Re: [PATCH 0/5] bridge: RCU annotation and cleanup
Date: Mon, 15 Nov 2010 14:33:07 +0100 [thread overview]
Message-ID: <1289827987.2607.50.camel@edumazet-laptop> (raw)
In-Reply-To: <201011152123.HHB21896.HFOOVSMFOtLJQF@I-love.SAKURA.ne.jp>
Le lundi 15 novembre 2010 à 21:23 +0900, Tetsuo Handa a écrit :
> Stephen Hemminger wrote:
> > This is a split up of what Eric did with a couple of small changes and additions.
> Something seems to be wrong with this patchset.
>
> --- a/net/bridge/br_input.c
> +++ b/net/bridge/br_input.c
> > @@ -173,8 +177,8 @@ forward:
> > switch (p->state) {
> > case BR_STATE_FORWARDING:
> > rhook = rcu_dereference(br_should_route_hook);
> > - if (rhook != NULL) {
> > - if (rhook(skb))
> > + if (rhook) {
> > + if ((*rhook)(skb))
>
> Is *rhook != NULL guaranteed when rhook != NULL?
Its the C standard convention, we call function pointed by rhook, not
*rhook.
$ cat func.c
typedef int (*hook_t)(int a1, int a2);
hook_t *hook;
int foo(int a1, int a2)
{
hook_t *handler = hook;
if (handler)
return handler(a1, a2);
return 0;
}
$ gcc -O2 -c func.c
func.c: In function ‘foo’:
func.c:10:17: error: called object ‘handler’ is not a function
Now, if we use (*handler), it works :
$ cat func.c
typedef int (*hook_t)(int a1, int a2);
hook_t *hook;
int foo(int a1, int a2)
{
hook_t *handler = hook;
if (handler)
return (*handler)(a1, a2);
return 0;
}
$ gcc -O2 -c func.c
$
next prev parent reply other threads:[~2010-11-15 13:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-14 21:12 [PATCH 0/5] bridge: RCU annotation and cleanup Stephen Hemminger
2010-11-14 21:12 ` [PATCH 1/5] bridge: add RCU annotation to bridge multicast table Stephen Hemminger
2010-11-14 21:12 ` [PATCH 2/5] bridge: add proper RCU annotation to should_route_hook Stephen Hemminger
2010-11-14 21:12 ` [PATCH 3/5] netdev: add rcu annotations to receive handler hook Stephen Hemminger
2010-11-14 21:12 ` [PATCH 4/5] bridge: fix RCU races with bridge port Stephen Hemminger
2010-11-14 21:12 ` [PATCH 5/5] bridge: add RCU annotations to bridge port lookup Stephen Hemminger
2010-11-15 12:23 ` [PATCH 0/5] bridge: RCU annotation and cleanup Tetsuo Handa
2010-11-15 13:33 ` Eric Dumazet [this message]
2010-11-15 16:19 ` Stephen Hemminger
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=1289827987.2607.50.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=shemminger@vyatta.com \
/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