Skip to content

Commit 92548b0

Browse files
edumazetdavem330
authored andcommitted
ipv4: fix endianness issue in inet_rtm_getroute_build_skb()
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: 404eb77 ("ipv4: support sport, dport and ip_proto in RTM_GETROUTE") Signed-off-by: Eric Dumazet <[email protected]> Cc: Roopa Prabhu <[email protected]> Cc: David Ahern <[email protected]> Reviewed-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 616920a commit 92548b0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/route.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3165,7 +3165,7 @@ static struct sk_buff *inet_rtm_getroute_build_skb(__be32 src, __be32 dst,
31653165
udph = skb_put_zero(skb, sizeof(struct udphdr));
31663166
udph->source = sport;
31673167
udph->dest = dport;
3168-
udph->len = sizeof(struct udphdr);
3168+
udph->len = htons(sizeof(struct udphdr));
31693169
udph->check = 0;
31703170
break;
31713171
}

0 commit comments

Comments
 (0)