From 1f27e2516c1d95ae19024bec5be68a3f489cc47e Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Thu, 10 May 2012 22:11:54 +0000 Subject: netfilter: xt_hashlimit: use _ALL macro to reject unknown flag bits David Miller says: The canonical way to validate if the set bits are in a valid range is to have a "_ALL" macro, and test: if (val & ~XT_HASHLIMIT_ALL) goto err;" make it so. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso --- net/netfilter/xt_hashlimit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net/netfilter/xt_hashlimit.c') diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c index 5d5af1d04fa2..26a668a84aa2 100644 --- a/net/netfilter/xt_hashlimit.c +++ b/net/netfilter/xt_hashlimit.c @@ -647,7 +647,7 @@ static int hashlimit_mt_check(const struct xt_mtchk_param *par) return -EINVAL; } - if (info->cfg.mode >= XT_HASHLIMIT_MAX) { + if (info->cfg.mode & ~XT_HASHLIMIT_ALL) { pr_info("Unknown mode mask %X, kernel too old?\n", info->cfg.mode); return -EINVAL; -- cgit v1.2.3-59-g8ed1b