Patchwork [net] ipv6: Fix addrconf_dst_alloc() failure check.

login
register
mail settings
Submitter YOSHIFUJI Hideaki / 吉藤英明
Date Jan. 18, 2013, 11:56 a.m.
Message ID <50F93879.6010201@linux-ipv6.org>
Download mbox | patch
Permalink /patch/213583/
State Rejected
Delegated to: David Miller
Headers show

Comments

YOSHIFUJI Hideaki / 吉藤英明 - Jan. 18, 2013, 11:56 a.m.
The function returns NULL on error and it never return error code
embedded in pointer.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
 net/ipv6/addrconf.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Eric Dumazet - Jan. 18, 2013, 2:28 p.m.
On Fri, 2013-01-18 at 20:56 +0900, YOSHIFUJI Hideaki wrote:
> The function returns NULL on error and it never return error code
> embedded in pointer.
> 

Which functions returns NULL ?

addrconf_dst_alloc() returns ERR_PTR(-ENOMEM) in case of error in my net
tree.

Also, please consider adding the bug origin in your changelogs.

Thanks !

> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> ---
>  net/ipv6/addrconf.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 420e563..d0a2df2b 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -783,8 +783,8 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
>  	}
>  
>  	rt = addrconf_dst_alloc(idev, addr, false);
> -	if (IS_ERR(rt)) {
> -		err = PTR_ERR(rt);
> +	if (!rt) {
> +		err = -ENOMEM;
>  		goto out;
>  	}
>  


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
YOSHIFUJI Hideaki / 吉藤英明 - Jan. 18, 2013, 2:38 p.m.
Eric Dumazet wrote:
> On Fri, 2013-01-18 at 20:56 +0900, YOSHIFUJI Hideaki wrote:
>> The function returns NULL on error and it never return error code
>> embedded in pointer.
>>
> 
> Which functions returns NULL ?
> 
> addrconf_dst_alloc() returns ERR_PTR(-ENOMEM) in case of error in my net
> tree.
> 
> Also, please consider adding the bug origin in your changelogs.

Oh, right.  I probably looked into different dst_alloc variants
and was confused.  Please ignore.

--yoshfuji
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 420e563..d0a2df2b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -783,8 +783,8 @@  ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
 	}
 
 	rt = addrconf_dst_alloc(idev, addr, false);
-	if (IS_ERR(rt)) {
-		err = PTR_ERR(rt);
+	if (!rt) {
+		err = -ENOMEM;
 		goto out;
 	}