From: Phil Sutter Date: Tue, 20 Aug 2019 22:28:21 +0000 (+0200) Subject: nft: Get rid of NFT_COMPAT_EXPR_MAX define X-Git-Tag: v1.8.4~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b148f23cd0ccb0f0eafef92761a98cf6b8b1396;p=thirdparty%2Fiptables.git nft: Get rid of NFT_COMPAT_EXPR_MAX define Instead simply use ARRAY_SIZE() macro to not overstep supported_exprs array. Signed-off-by: Phil Sutter Acked-by: Pablo Neira Ayuso --- diff --git a/iptables/nft.c b/iptables/nft.c index 90bb0c63..a2c43e83 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@ -3332,9 +3332,7 @@ uint32_t nft_invflags2cmp(uint32_t invflags, uint32_t flag) return NFT_CMP_EQ; } -#define NFT_COMPAT_EXPR_MAX 8 - -static const char *supported_exprs[NFT_COMPAT_EXPR_MAX] = { +static const char *supported_exprs[] = { "match", "target", "payload", @@ -3351,7 +3349,7 @@ static int nft_is_expr_compatible(struct nftnl_expr *expr, void *data) const char *name = nftnl_expr_get_str(expr, NFTNL_EXPR_NAME); int i; - for (i = 0; i < NFT_COMPAT_EXPR_MAX; i++) { + for (i = 0; i < ARRAY_SIZE(supported_exprs); i++) { if (strcmp(supported_exprs[i], name) == 0) return 0; }