All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ipvlan: fix incorrect usage of IS_ERR() macro in IPv6 code path.
@ 2015-01-25  5:53 Mahesh Bandewar
  2015-01-25  8:24 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Mahesh Bandewar @ 2015-01-25  5:53 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, Eric Dumazet, Dan Carpenter, Mahesh Bandewar

The ip6_route_output() always returns a valid dst pointer unlike in IPv4
case. So the validation has to be different from the IPv4 path. Correcting
that error in this patch.

This was picked up by a static checker with a following warning -

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

Signed-off-by: Mahesh Bandewar <maheshb@google.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/ipvlan/ipvlan_core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index a14d87783245..2e195289ddf4 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -377,9 +377,11 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
 	};
 
 	dst = ip6_route_output(dev_net(dev), NULL, &fl6);
-	if (IS_ERR(dst))
+	if (dst->error) {
+		ret = dst->error;
+		dst_release(dst);
 		goto err;
-
+	}
 	skb_dst_drop(skb);
 	skb_dst_set(skb, dst);
 	err = ip6_local_out(skb);
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] ipvlan: fix incorrect usage of IS_ERR() macro in IPv6 code path.
  2015-01-25  5:53 [PATCH net] ipvlan: fix incorrect usage of IS_ERR() macro in IPv6 code path Mahesh Bandewar
@ 2015-01-25  8:24 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-01-25  8:24 UTC (permalink / raw)
  To: maheshb; +Cc: netdev, edumazet, dan.carpenter

From: Mahesh Bandewar <maheshb@google.com>
Date: Sat, 24 Jan 2015 21:53:43 -0800

> The ip6_route_output() always returns a valid dst pointer unlike in IPv4
> case. So the validation has to be different from the IPv4 path. Correcting
> that error in this patch.
> 
> This was picked up by a static checker with a following warning -
> 
>    drivers/net/ipvlan/ipvlan_core.c:380 ipvlan_process_v6_outbound()
>         warn: 'dst' isn't an ERR_PTR
> 
> Signed-off-by: Mahesh Bandewar <maheshb@google.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-25  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-25  5:53 [PATCH net] ipvlan: fix incorrect usage of IS_ERR() macro in IPv6 code path Mahesh Bandewar
2015-01-25  8:24 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.