diff mbox series

[net] ipv4: fix endianness issue in inet_rtm_getroute_build_skb()

Message ID 20210831020210.726942-1-eric.dumazet@gmail.com (mailing list archive)
State Accepted
Commit 92548b0ee220e000d81c27ac9a80e0ede895a881
Delegated to: Netdev Maintainers
Headers show
Series [net] ipv4: fix endianness issue in inet_rtm_getroute_build_skb() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers fail 1 blamed authors not CCed: roopa@cumulusnetworks.com; 2 maintainers not CCed: roopa@cumulusnetworks.com yoshfuji@linux-ipv6.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 5 this patch: 4
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 5 this patch: 4
netdev/header_inline success Link

Commit Message

Eric Dumazet Aug. 31, 2021, 2:02 a.m. UTC
From: Eric Dumazet <edumazet@google.com>

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>
---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Ahern Aug. 31, 2021, 2:34 a.m. UTC | #1
On 8/30/21 7:02 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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>
> ---
>  net/ipv4/route.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
patchwork-bot+netdevbpf@kernel.org Aug. 31, 2021, 11:10 a.m. UTC | #2
Hello:

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

On Mon, 30 Aug 2021 19:02:10 -0700 you wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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
diff mbox series

Patch

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 225714b5efc0b9c6bcd2d58a62d4656cdc5a1cde..94e33d3eaf621d99baeab338e4e847471d835215 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;
 	}