Skip to contentSkip to conversation

ipv6: Fix addrconf_dst_alloc() failure check.

PATCH In review YOSHIFUJI Hideaki 2 participants 3 messages Jan 18, 2013

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

PATCH 1/1 ipv6: Fix addrconf_dst_alloc() failure check.

The function returns NULL on error and it never return error code embedded in pointer.

---
 net/ipv6/addrconf.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/addrconf.c +2 -2
index 420e563..d0a2df2b 100644
@@ -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;
 	}
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 3 lines · YOSHIFUJI Hideaki

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 !

Quoted 20 lines
---
 net/ipv6/addrconf.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv6/addrconf.c +2 -2
index 420e563..d0a2df2b 100644
@@ -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;
 	}
 
#2 lore raw
Quoted 11 lines · Eric Dumazet
Quoted 3 lines · YOSHIFUJI Hideaki

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