Skip to content

Commit e41e9d6

Browse files
Liping Zhangummakynes
authored andcommitted
netfilter: nf_tables: remove useless U8_MAX validation
After call nft_data_init, size is already validated and desc.len will not exceed the sizeof(struct nft_data), i.e. 16 bytes. So it will never exceed U8_MAX. Furthermore, in nft_immediate_init, we forget to call nft_data_uninit when desc.len exceeds U8_MAX, although this will not happen, but it's a logical mistake. Now remove these redundant validation introduced by commit 36b701f ("netfilter: nf_tables: validate maximum value of u32 netlink attributes") Signed-off-by: Liping Zhang <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 2fa8419 commit e41e9d6

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

net/netfilter/nft_cmp.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ static int nft_cmp_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
8484
if (err < 0)
8585
return err;
8686

87-
if (desc.len > U8_MAX)
88-
return -ERANGE;
89-
9087
priv->op = ntohl(nla_get_be32(tb[NFTA_CMP_OP]));
9188
priv->len = desc.len;
9289
return 0;

net/netfilter/nft_immediate.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ static int nft_immediate_init(const struct nft_ctx *ctx,
5454
if (err < 0)
5555
return err;
5656

57-
if (desc.len > U8_MAX)
58-
return -ERANGE;
59-
6057
priv->dlen = desc.len;
6158

6259
priv->dreg = nft_parse_register(tb[NFTA_IMMEDIATE_DREG]);

0 commit comments

Comments
 (0)