]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ipv4: nexthop: Use nla_put_be32() for NHA_GATEWAY
authorIdo Schimmel <idosch@nvidia.com>
Wed, 26 Aug 2020 16:48:52 +0000 (19:48 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Aug 2020 23:00:51 +0000 (16:00 -0700)
The code correctly uses nla_get_be32() to get the payload of the
attribute, but incorrectly uses nla_put_u32() to add the attribute to
the payload. This results in the following warning:

net/ipv4/nexthop.c:279:59: warning: incorrect type in argument 3 (different base types)
net/ipv4/nexthop.c:279:59:    expected unsigned int [usertype] value
net/ipv4/nexthop.c:279:59:    got restricted __be32 [usertype] ipv4

Suppress the warning by using nla_put_be32().

Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/nexthop.c

index d13730ff9aebc87be4c61cbbcb01e92bbc661aee..0823643a7decbb61fe15879c329c14aa58d631d0 100644 (file)
@@ -276,7 +276,7 @@ static int nh_fill_node(struct sk_buff *skb, struct nexthop *nh,
        case AF_INET:
                fib_nh = &nhi->fib_nh;
                if (fib_nh->fib_nh_gw_family &&
-                   nla_put_u32(skb, NHA_GATEWAY, fib_nh->fib_nh_gw4))
+                   nla_put_be32(skb, NHA_GATEWAY, fib_nh->fib_nh_gw4))
                        goto nla_put_failure;
                break;