netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: ipmr: ipmr_get_table() returns NULL
@ 2017-07-12  7:56 Dan Carpenter
  2017-07-12  8:02 ` Nikolay Aleksandrov
  2017-07-12 15:19 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-07-12  7:56 UTC (permalink / raw)
  To: David S. Miller, Donald Sharp
  Cc: Alexey Kuznetsov, Hideaki YOSHIFUJI, netdev, kernel-janitors

The ipmr_get_table() function doesn't return error pointers it returns
NULL on error.

Fixes: 4f75ba6982bc ("net: ipmr: Add ipmr_rtm_getroute")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index bb909f1d7537..06863ea3fc5b 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -2431,8 +2431,8 @@ static int ipmr_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 	tableid = tb[RTA_TABLE] ? nla_get_u32(tb[RTA_TABLE]) : 0;
 
 	mrt = ipmr_get_table(net, tableid ? tableid : RT_TABLE_DEFAULT);
-	if (IS_ERR(mrt)) {
-		err = PTR_ERR(mrt);
+	if (!mrt) {
+		err = -ENOENT;
 		goto errout_free;
 	}
 

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

* Re: [PATCH net] net: ipmr: ipmr_get_table() returns NULL
  2017-07-12  7:56 [PATCH net] net: ipmr: ipmr_get_table() returns NULL Dan Carpenter
@ 2017-07-12  8:02 ` Nikolay Aleksandrov
  2017-07-12 15:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Aleksandrov @ 2017-07-12  8:02 UTC (permalink / raw)
  To: Dan Carpenter, David S. Miller, Donald Sharp
  Cc: Alexey Kuznetsov, Hideaki YOSHIFUJI, netdev, kernel-janitors

On 12/07/17 10:56, Dan Carpenter wrote:
> The ipmr_get_table() function doesn't return error pointers it returns
> NULL on error.
> 
> Fixes: 4f75ba6982bc ("net: ipmr: Add ipmr_rtm_getroute")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
> index bb909f1d7537..06863ea3fc5b 100644
> --- a/net/ipv4/ipmr.c
> +++ b/net/ipv4/ipmr.c
> @@ -2431,8 +2431,8 @@ static int ipmr_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
>  	tableid = tb[RTA_TABLE] ? nla_get_u32(tb[RTA_TABLE]) : 0;
>  
>  	mrt = ipmr_get_table(net, tableid ? tableid : RT_TABLE_DEFAULT);
> -	if (IS_ERR(mrt)) {
> -		err = PTR_ERR(mrt);
> +	if (!mrt) {
> +		err = -ENOENT;
>  		goto errout_free;
>  	}
>  
> 

Good catch, ipmr_new_table() is the one that can return err ptr.

Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

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

* Re: [PATCH net] net: ipmr: ipmr_get_table() returns NULL
  2017-07-12  7:56 [PATCH net] net: ipmr: ipmr_get_table() returns NULL Dan Carpenter
  2017-07-12  8:02 ` Nikolay Aleksandrov
@ 2017-07-12 15:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-07-12 15:19 UTC (permalink / raw)
  To: dan.carpenter; +Cc: sharpd, kuznet, yoshfuji, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 12 Jul 2017 10:56:47 +0300

> The ipmr_get_table() function doesn't return error pointers it returns
> NULL on error.
> 
> Fixes: 4f75ba6982bc ("net: ipmr: Add ipmr_rtm_getroute")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

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

end of thread, other threads:[~2017-07-12 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-12  7:56 [PATCH net] net: ipmr: ipmr_get_table() returns NULL Dan Carpenter
2017-07-12  8:02 ` Nikolay Aleksandrov
2017-07-12 15:19 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).