diff options
author | Eric Dumazet <edumazet@google.com> | 2021-08-30 19:02:10 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-09-15 10:02:32 +0200 |
commit | 808b4c3ca23d9fe85d7e1a3134d21eabfb45431b (patch) | |
tree | 299b3712a365e3456dd9900567d715feb0f92f0d | |
parent | f996358d94d529376bd1ea6bada78c274088a016 (diff) | |
download | linux-stable-808b4c3ca23d9fe85d7e1a3134d21eabfb45431b.tar.gz linux-stable-808b4c3ca23d9fe85d7e1a3134d21eabfb45431b.tar.bz2 linux-stable-808b4c3ca23d9fe85d7e1a3134d21eabfb45431b.zip |
ipv4: fix endianness issue in inet_rtm_getroute_build_skb()
[ Upstream commit 92548b0ee220e000d81c27ac9a80e0ede895a881 ]
The UDP length field should be in network order.
This removes the following sparse error:
net/ipv4/route.c:3173:27: warning: incorrect type in assignment (different base types)
net/ipv4/route.c:3173:27: expected restricted __be16 [usertype] len
net/ipv4/route.c:3173:27: got unsigned long
Fixes: 404eb77ea766 ("ipv4: support sport, dport and ip_proto in RTM_GETROUTE")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Roopa Prabhu <roopa@nvidia.com>
Cc: David Ahern <dsahern@kernel.org>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | net/ipv4/route.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 225714b5efc0..94e33d3eaf62 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -3184,7 +3184,7 @@ static struct sk_buff *inet_rtm_getroute_build_skb(__be32 src, __be32 dst, udph = skb_put_zero(skb, sizeof(struct udphdr)); udph->source = sport; udph->dest = dport; - udph->len = sizeof(struct udphdr); + udph->len = htons(sizeof(struct udphdr)); udph->check = 0; break; } |