forked from Minki/linux
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: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
168141f7e0
commit
d86473bf2f
@ -44,7 +44,8 @@ void nft_byteorder_eval(const struct nft_expr *expr,
|
||||
case NFT_BYTEORDER_NTOH:
|
||||
for (i = 0; i < priv->len / 8; 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;
|
||||
case NFT_BYTEORDER_HTON:
|
||||
|
@ -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))
|
||||
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;
|
||||
|
||||
if (nft_dump_register(skb, NFTA_OSF_DREG, priv->dreg))
|
||||
|
@ -163,7 +163,7 @@ static int nft_socket_init(const struct nft_ctx *ctx,
|
||||
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) {
|
||||
case NFT_SOCKET_TRANSPARENT:
|
||||
case NFT_SOCKET_WILDCARD:
|
||||
@ -179,7 +179,7 @@ static int nft_socket_init(const struct nft_ctx *ctx,
|
||||
if (!tb[NFTA_SOCKET_LEVEL])
|
||||
return -EINVAL;
|
||||
|
||||
level = ntohl(nla_get_u32(tb[NFTA_SOCKET_LEVEL]));
|
||||
level = ntohl(nla_get_be32(tb[NFTA_SOCKET_LEVEL]));
|
||||
if (level > 255)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
@ -202,12 +202,12 @@ static int nft_socket_dump(struct sk_buff *skb,
|
||||
{
|
||||
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;
|
||||
if (nft_dump_register(skb, NFTA_SOCKET_DREG, priv->dreg))
|
||||
return -1;
|
||||
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 0;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ static int nft_xfrm_get_init(const struct nft_ctx *ctx,
|
||||
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) {
|
||||
case NFT_XFRM_KEY_REQID:
|
||||
case NFT_XFRM_KEY_SPI:
|
||||
@ -134,13 +134,13 @@ static void nft_xfrm_state_get_key(const struct nft_xfrm *priv,
|
||||
WARN_ON_ONCE(1);
|
||||
break;
|
||||
case NFT_XFRM_KEY_DADDR_IP4:
|
||||
*dest = state->id.daddr.a4;
|
||||
*dest = (__force __u32)state->id.daddr.a4;
|
||||
return;
|
||||
case NFT_XFRM_KEY_DADDR_IP6:
|
||||
memcpy(dest, &state->id.daddr.in6, sizeof(struct in6_addr));
|
||||
return;
|
||||
case NFT_XFRM_KEY_SADDR_IP4:
|
||||
*dest = state->props.saddr.a4;
|
||||
*dest = (__force __u32)state->props.saddr.a4;
|
||||
return;
|
||||
case NFT_XFRM_KEY_SADDR_IP6:
|
||||
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,
|
||||
*dest = state->props.reqid;
|
||||
return;
|
||||
case NFT_XFRM_KEY_SPI:
|
||||
*dest = state->id.spi;
|
||||
*dest = (__force __u32)state->id.spi;
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user