From: Pablo Neira Ayuso Date: Wed, 14 Mar 2007 23:41:03 +0000 (-0700) Subject: [NETFILTER]: nfnetlink: remove duplicate checks in nfnetlink_check_attributes X-Git-Tag: v2.6.22-rc1~1128^2~296 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9e6d029498ab9e943c70f24c027aeda5602196d;p=linux-2.6 [NETFILTER]: nfnetlink: remove duplicate checks in nfnetlink_check_attributes Remove nfnetlink_check_attributes duplicates message size and callback id checks. nfnetlink_find_client and nfnetlink_rcv_msg already do such checks. Signed-off-by: Pablo Neira Ayuso Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index c8b4f0d29d..9d33807ec1 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c @@ -149,17 +149,10 @@ static int nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys, struct nlmsghdr *nlh, struct nfattr *cda[]) { - int min_len; + int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg)); u_int16_t attr_count; u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type); - if (unlikely(cb_id >= subsys->cb_count)) - return -EINVAL; - - min_len = NLMSG_SPACE(sizeof(struct nfgenmsg)); - if (unlikely(nlh->nlmsg_len < min_len)) - return -EINVAL; - attr_count = subsys->cb[cb_id].attr_count; memset(cda, 0, sizeof(struct nfattr *) * attr_count);