Commit d86473bf authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: nf_tables: use the correct get/put helpers

Switch to be16/32 and u16/32 respectively.  No code changes here,
the functions do the same thing, this is just for sparse checkers' sake.

objdiff shows no changes.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 168141f7
...@@ -44,7 +44,8 @@ void nft_byteorder_eval(const struct nft_expr *expr, ...@@ -44,7 +44,8 @@ void nft_byteorder_eval(const struct nft_expr *expr,
case NFT_BYTEORDER_NTOH: case NFT_BYTEORDER_NTOH:
for (i = 0; i < priv->len / 8; i++) { for (i = 0; i < priv->len / 8; i++) {
src64 = nft_reg_load64(&src[i]); src64 = nft_reg_load64(&src[i]);
nft_reg_store64(&dst[i], be64_to_cpu(src64)); nft_reg_store64(&dst[i],
be64_to_cpu((__force __be64)src64));
} }
break; break;
case NFT_BYTEORDER_HTON: case NFT_BYTEORDER_HTON:
......
...@@ -99,7 +99,7 @@ static int nft_osf_dump(struct sk_buff *skb, const struct nft_expr *expr) ...@@ -99,7 +99,7 @@ static int nft_osf_dump(struct sk_buff *skb, const struct nft_expr *expr)
if (nla_put_u8(skb, NFTA_OSF_TTL, priv->ttl)) if (nla_put_u8(skb, NFTA_OSF_TTL, priv->ttl))
goto nla_put_failure; goto nla_put_failure;
if (nla_put_be32(skb, NFTA_OSF_FLAGS, ntohl(priv->flags))) if (nla_put_u32(skb, NFTA_OSF_FLAGS, ntohl((__force __be32)priv->flags)))
goto nla_put_failure; goto nla_put_failure;
if (nft_dump_register(skb, NFTA_OSF_DREG, priv->dreg)) if (nft_dump_register(skb, NFTA_OSF_DREG, priv->dreg))
......
...@@ -163,7 +163,7 @@ static int nft_socket_init(const struct nft_ctx *ctx, ...@@ -163,7 +163,7 @@ static int nft_socket_init(const struct nft_ctx *ctx,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
priv->key = ntohl(nla_get_u32(tb[NFTA_SOCKET_KEY])); priv->key = ntohl(nla_get_be32(tb[NFTA_SOCKET_KEY]));
switch(priv->key) { switch(priv->key) {
case NFT_SOCKET_TRANSPARENT: case NFT_SOCKET_TRANSPARENT:
case NFT_SOCKET_WILDCARD: case NFT_SOCKET_WILDCARD:
...@@ -179,7 +179,7 @@ static int nft_socket_init(const struct nft_ctx *ctx, ...@@ -179,7 +179,7 @@ static int nft_socket_init(const struct nft_ctx *ctx,
if (!tb[NFTA_SOCKET_LEVEL]) if (!tb[NFTA_SOCKET_LEVEL])
return -EINVAL; return -EINVAL;
level = ntohl(nla_get_u32(tb[NFTA_SOCKET_LEVEL])); level = ntohl(nla_get_be32(tb[NFTA_SOCKET_LEVEL]));
if (level > 255) if (level > 255)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -202,12 +202,12 @@ static int nft_socket_dump(struct sk_buff *skb, ...@@ -202,12 +202,12 @@ static int nft_socket_dump(struct sk_buff *skb,
{ {
const struct nft_socket *priv = nft_expr_priv(expr); const struct nft_socket *priv = nft_expr_priv(expr);
if (nla_put_u32(skb, NFTA_SOCKET_KEY, htonl(priv->key))) if (nla_put_be32(skb, NFTA_SOCKET_KEY, htonl(priv->key)))
return -1; return -1;
if (nft_dump_register(skb, NFTA_SOCKET_DREG, priv->dreg)) if (nft_dump_register(skb, NFTA_SOCKET_DREG, priv->dreg))
return -1; return -1;
if (priv->key == NFT_SOCKET_CGROUPV2 && if (priv->key == NFT_SOCKET_CGROUPV2 &&
nla_put_u32(skb, NFTA_SOCKET_LEVEL, htonl(priv->level))) nla_put_be32(skb, NFTA_SOCKET_LEVEL, htonl(priv->level)))
return -1; return -1;
return 0; return 0;
} }
......
...@@ -51,7 +51,7 @@ static int nft_xfrm_get_init(const struct nft_ctx *ctx, ...@@ -51,7 +51,7 @@ static int nft_xfrm_get_init(const struct nft_ctx *ctx,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
priv->key = ntohl(nla_get_u32(tb[NFTA_XFRM_KEY])); priv->key = ntohl(nla_get_be32(tb[NFTA_XFRM_KEY]));
switch (priv->key) { switch (priv->key) {
case NFT_XFRM_KEY_REQID: case NFT_XFRM_KEY_REQID:
case NFT_XFRM_KEY_SPI: case NFT_XFRM_KEY_SPI:
...@@ -134,13 +134,13 @@ static void nft_xfrm_state_get_key(const struct nft_xfrm *priv, ...@@ -134,13 +134,13 @@ static void nft_xfrm_state_get_key(const struct nft_xfrm *priv,
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
break; break;
case NFT_XFRM_KEY_DADDR_IP4: case NFT_XFRM_KEY_DADDR_IP4:
*dest = state->id.daddr.a4; *dest = (__force __u32)state->id.daddr.a4;
return; return;
case NFT_XFRM_KEY_DADDR_IP6: case NFT_XFRM_KEY_DADDR_IP6:
memcpy(dest, &state->id.daddr.in6, sizeof(struct in6_addr)); memcpy(dest, &state->id.daddr.in6, sizeof(struct in6_addr));
return; return;
case NFT_XFRM_KEY_SADDR_IP4: case NFT_XFRM_KEY_SADDR_IP4:
*dest = state->props.saddr.a4; *dest = (__force __u32)state->props.saddr.a4;
return; return;
case NFT_XFRM_KEY_SADDR_IP6: case NFT_XFRM_KEY_SADDR_IP6:
memcpy(dest, &state->props.saddr.in6, sizeof(struct in6_addr)); memcpy(dest, &state->props.saddr.in6, sizeof(struct in6_addr));
...@@ -149,7 +149,7 @@ static void nft_xfrm_state_get_key(const struct nft_xfrm *priv, ...@@ -149,7 +149,7 @@ static void nft_xfrm_state_get_key(const struct nft_xfrm *priv,
*dest = state->props.reqid; *dest = state->props.reqid;
return; return;
case NFT_XFRM_KEY_SPI: case NFT_XFRM_KEY_SPI:
*dest = state->id.spi; *dest = (__force __u32)state->id.spi;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment