* [PATCH net-2.6.25] [BRIDGE] Remove useless code in net/bridge/br_netfilter.c
@ 2008-01-01 10:48 Rami Rosen
2008-01-02 5:20 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Rami Rosen @ 2008-01-01 10:48 UTC (permalink / raw)
To: davem; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
Hi,
These following two commands in br_nf_forward_arp() achieve nothing and
should be removed; the d variable is not used later in this method:
...
struct net_device **d = (struct net_device **)(skb->cb);
...
*d = (struct net_device *)in;
...
Regards,
Rami Rosen
Signed-off-by: Rami Rosen <ramirose@gmail.com>
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 788 bytes --]
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 32ac035..288e102 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -664,8 +664,6 @@ static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff *skb,
const struct net_device *out,
int (*okfn)(struct sk_buff *))
{
- struct net_device **d = (struct net_device **)(skb->cb);
-
#ifdef CONFIG_SYSCTL
if (!brnf_call_arptables)
return NF_ACCEPT;
@@ -682,7 +680,6 @@ static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff *skb,
nf_bridge_push_encap_header(skb);
return NF_ACCEPT;
}
- *d = (struct net_device *)in;
NF_HOOK(NF_ARP, NF_ARP_FORWARD, skb, (struct net_device *)in,
(struct net_device *)out, br_nf_forward_finish);
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-2.6.25] [BRIDGE] Remove useless code in net/bridge/br_netfilter.c
2008-01-01 10:48 [PATCH net-2.6.25] [BRIDGE] Remove useless code in net/bridge/br_netfilter.c Rami Rosen
@ 2008-01-02 5:20 ` David Miller
2008-01-02 6:16 ` Rami Rosen
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2008-01-02 5:20 UTC (permalink / raw)
To: ramirose; +Cc: netdev
From: "Rami Rosen" <ramirose@gmail.com>
Date: Tue, 1 Jan 2008 12:48:14 +0200
> These following two commands in br_nf_forward_arp() achieve nothing and
> should be removed; the d variable is not used later in this method:
>
> ...
> struct net_device **d = (struct net_device **)(skb->cb);
> ...
> *d = (struct net_device *)in;
> ...
>
> Signed-off-by: Rami Rosen <ramirose@gmail.com>
It's a pointer dereference assignment, this last line has a
side effect, therefore you can't remove it.
The code is equivalent to:
struct skb_bridge_info {
struct net_device *dev;
};
struct skb_bridge_info *d;
d = (struct skb_bridge_info *) skb->cb;
d->dev = in;
What automated tool showed this as useless to you?
Please correct it's logic so it doesn't mark real side effects like
this as superfluous.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net-2.6.25] [BRIDGE] Remove useless code in net/bridge/br_netfilter.c
2008-01-02 5:20 ` David Miller
@ 2008-01-02 6:16 ` Rami Rosen
0 siblings, 0 replies; 3+ messages in thread
From: Rami Rosen @ 2008-01-02 6:16 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Hi,
> It's a pointer dereference assignment,
Sorry, I was wrong here !
> What automated tool showed this as useless to you?
> Please correct it's logic so it doesn't mark real side effects like
> this as superfluous.
I am not using any automated tool, only my eyes. And I
missed the intention here. It could be implemnted differently
but since it not marked as superfluous anywhere I suggest
to leave it as it is.
Sorry,
Regards,
Rami Rosen
On Jan 2, 2008 7:20 AM, David Miller <davem@davemloft.net> wrote:
> From: "Rami Rosen" <ramirose@gmail.com>
> Date: Tue, 1 Jan 2008 12:48:14 +0200
>
> > These following two commands in br_nf_forward_arp() achieve nothing and
> > should be removed; the d variable is not used later in this method:
> >
> > ...
> > struct net_device **d = (struct net_device **)(skb->cb);
> > ...
> > *d = (struct net_device *)in;
> > ...
> >
> > Signed-off-by: Rami Rosen <ramirose@gmail.com>
>
> It's a pointer dereference assignment, this last line has a
> side effect, therefore you can't remove it.
>
> The code is equivalent to:
>
> struct skb_bridge_info {
> struct net_device *dev;
> };
>
> struct skb_bridge_info *d;
>
> d = (struct skb_bridge_info *) skb->cb;
>
> d->dev = in;
>
> What automated tool showed this as useless to you?
>
> Please correct it's logic so it doesn't mark real side effects like
> this as superfluous.
>
> Thanks.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-01-02 6:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-01 10:48 [PATCH net-2.6.25] [BRIDGE] Remove useless code in net/bridge/br_netfilter.c Rami Rosen
2008-01-02 5:20 ` David Miller
2008-01-02 6:16 ` Rami Rosen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox