Skip to contentSkip to conversation

ipvlan: Initial check-in of the IPVLAN driver.

DISCUSSION Dan Carpenter 3 participants 3 messages Jan 19, 2015 – Jan 23, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Mahesh Bandewar,

The patch 2ad7bf363841: "ipvlan: Initial check-in of the IPVLAN driver." from Nov 23, 2014, leads to the following static checker warning:

drivers/net/ipvlan/ipvlan_core.c:380 ipvlan_process_v6_outbound()
warn: 'dst' isn't an ERR_PTR

drivers/net/ipvlan/ipvlan_core.c
378
379 dst = ip6_route_output(dev_net(dev), NULL, &fl6);
380 if (IS_ERR(dst))
381 goto err;

The ip6_route_output() function is not documented but it always returns a valid pointer. I believe you are supposed to check something like:

		if (dst->error) {
			ret = dst->error;
			goto error;
		}
   382  
   383          skb_dst_drop(skb);
   384          skb_dst_set(skb, dst);

regards,
dan carpenter

maintainer
#1 lore raw

From: Dan Carpenter <[email protected]>
Date: Mon, 19 Jan 2015 17:40:11 +0300

Quoted 16 lines

The patch 2ad7bf363841: "ipvlan: Initial check-in of the IPVLAN driver." from Nov 23, 2014, leads to the following static checker warning:

drivers/net/ipvlan/ipvlan_core.c:380 ipvlan_process_v6_outbound()
warn: 'dst' isn't an ERR_PTR

drivers/net/ipvlan/ipvlan_core.c
378

   379          dst = ip6_route_output(dev_net(dev), NULL, &fl6);
   380          if (IS_ERR(dst))
   381                  goto err;

The ip6_route_output() function is not documented but it always returns a valid pointer. I believe you are supposed to check something like:

Quoted 8 lines
		if (dst->error) {
			ret = dst->error;
			goto error;
		}
   382  
   383          skb_dst_drop(skb);
   384          skb_dst_set(skb, dst);

This is correct.

#2 lore raw
Quoted 24 lines · David Miller

From: Dan Carpenter <[email protected]>
Date: Mon, 19 Jan 2015 17:40:11 +0300

Quoted 21 lines

The patch 2ad7bf363841: "ipvlan: Initial check-in of the IPVLAN driver." from Nov 23, 2014, leads to the following static checker warning:

drivers/net/ipvlan/ipvlan_core.c:380 ipvlan_process_v6_outbound()
warn: 'dst' isn't an ERR_PTR

drivers/net/ipvlan/ipvlan_core.c
378

   379          dst = ip6_route_output(dev_net(dev), NULL, &fl6);
   380          if (IS_ERR(dst))
   381                  goto err;

The ip6_route_output() function is not documented but it always returns a valid pointer. I believe you are supposed to check something like:

              if (dst->error) {
                      ret = dst->error;
                      goto error;
              }
Quoted 5 lines
Quoted 3 lines
   382
   383          skb_dst_drop(skb);
   384          skb_dst_set(skb, dst);

This is correct.

Thanks Dan for pointing it out. I'll send a patch correcting that code.