net/sched: cls_flower: use ntohs for struct flow_dissector_key_ports
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sun, 21 Mar 2021 21:05:48 +0000 (23:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:12:53 +0000 (10:12 +0200)
commitfccb35bbf75f50b00a059b61ed38b2497dc50199
treefa1bac2c5533695a46b725de5b2ae957f330b7fe
parenta019b8d7dfd53018e6a7204e1e1d3858f208c964
net/sched: cls_flower: use ntohs for struct flow_dissector_key_ports

[ Upstream commit 6215afcb9a7e35cef334dc0ae7f998cc72c8465f ]

A make W=1 build complains that:

net/sched/cls_flower.c:214:20: warning: cast from restricted __be16
net/sched/cls_flower.c:214:20: warning: incorrect type in argument 1 (different base types)
net/sched/cls_flower.c:214:20:    expected unsigned short [usertype] val
net/sched/cls_flower.c:214:20:    got restricted __be16 [usertype] dst

This is because we use htons on struct flow_dissector_key_ports members
src and dst, which are defined as __be16, so they are already in network
byte order, not host. The byte swap function for the other direction
should have been used.

Because htons and ntohs do the same thing (either both swap, or none
does), this change has no functional effect except to silence the
warnings.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/cls_flower.c