netlink: make nlmsg_end() and genlmsg_end() void
[firefly-linux-kernel-4.4.55.git] / net / phonet / pn_netlink.c
index b64151ade6b33a9cbacb0980d3ddbe03d8f7b4c8..54d766842c2b55a6ba03071a5991a4c91547f072 100644 (file)
@@ -121,7 +121,8 @@ static int fill_addr(struct sk_buff *skb, struct net_device *dev, u8 addr,
        ifm->ifa_index = dev->ifindex;
        if (nla_put_u8(skb, IFA_LOCAL, addr))
                goto nla_put_failure;
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
@@ -190,7 +191,8 @@ static int fill_route(struct sk_buff *skb, struct net_device *dev, u8 dst,
        if (nla_put_u8(skb, RTA_DST, dst) ||
            nla_put_u32(skb, RTA_OIF, dev->ifindex))
                goto nla_put_failure;
-       return nlmsg_end(skb, nlh);
+       nlmsg_end(skb, nlh);
+       return 0;
 
 nla_put_failure:
        nlmsg_cancel(skb, nlh);
@@ -282,9 +284,13 @@ static int route_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
 
                if (addr_idx++ < addr_start_idx)
                        continue;
-               if (fill_route(skb, dev, addr << 2, NETLINK_CB(cb->skb).portid,
-                               cb->nlh->nlmsg_seq, RTM_NEWROUTE))
-                       goto out;
+               fill_route(skb, dev, addr << 2, NETLINK_CB(cb->skb).portid,
+                          cb->nlh->nlmsg_seq, RTM_NEWROUTE);
+               /* fill_route() used to return > 0 (or negative errors) but
+                * never 0 - ignore the return value and just go out to
+                * call dumpit again from outside to preserve the behavior
+                */
+               goto out;
        }
 
 out: