The following commit has been merged in the next branch: commit 604b2cfd9de3c25d1b57cfeaef4d1e7e71dbafee Author: Sven Eckelmann sven.eckelmann@gmx.de Date: Sat Oct 9 11:51:49 2010 +0000
batman-adv: Don't dereference unchecked incoming soft_iface
send_packet derefenced forw_packet->if_incoming and checked if forw_packet->if_incoming is NULL.
This cannot happen, but still makes irritates when reading through the functions.
Reported-by: Dan Carpenter error27@gmail.com Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de
diff --git a/send.c b/send.c index 50c10b6..2f86dcc 100644 --- a/send.c +++ b/send.c @@ -161,8 +161,8 @@ static void send_packet_to_if(struct forw_packet *forw_packet, static void send_packet(struct forw_packet *forw_packet) { struct batman_if *batman_if; - struct net_device *soft_iface = forw_packet->if_incoming->soft_iface; - struct bat_priv *bat_priv = netdev_priv(soft_iface); + struct net_device *soft_iface; + struct bat_priv *bat_priv; struct batman_packet *batman_packet = (struct batman_packet *)(forw_packet->skb->data); unsigned char directlink = (batman_packet->flags & DIRECTLINK ? 1 : 0); @@ -173,6 +173,9 @@ static void send_packet(struct forw_packet *forw_packet) return; }
+ soft_iface = forw_packet->if_incoming->soft_iface; + bat_priv = netdev_priv(soft_iface); + if (forw_packet->if_incoming->if_status != IF_ACTIVE) return;