Skip to contentSkip to conversation

ipv4: fix endianness issue in inet_rtm_getroute_build_skb()

PATCH Applied Eric Dumazet 3 participants 3 messages Aug 31, 2021

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

PATCH 1/1 ipv4: fix endianness issue in inet_rtm_getroute_build_skb()

From: Eric Dumazet <[email protected]>

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")
Cc Roopa Prabhu <[email protected]>
Cc David Ahern <[email protected]>
---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/route.c +1 -1
index 225714b5efc0b9c6bcd2d58a62d4656cdc5a1cde..94e33d3eaf621d99baeab338e4e847471d835215 100644
@@ -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;
 	}
Signature · 1 line
2.33.0.259.gc128427fd7-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eric Dumazet

From: Eric Dumazet <[email protected]>

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

Quoted 8 lines
Fixes 404eb77ea766 ("ipv4: support sport, dport and ip_proto in RTM_GETROUTE")
Cc Roopa Prabhu <[email protected]>
Cc David Ahern <[email protected]>
---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 10 lines · On Mon, 30 Aug 2021 19:02:10 -0700 you wrote:

From: Eric Dumazet <[email protected]>

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

[...]

Here is the summary with links:
- [net] ipv4: fix endianness issue in inet_rtm_getroute_build_skb()

    https://git.kernel.org/netdev/net-next/c/92548b0ee220

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html