aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2007-03-14 19:41:03 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:48 -0400
commitd9e6d029498ab9e943c70f24c027aeda5602196d (patch)
tree6f678b301e2ed057e943fafc3182a40145ea9482 /net
parent67ca396606432aae3b747d5e6bb61d0c297eb782 (diff)
[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 <pablo@netfilter.org> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nfnetlink.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index c8b4f0d29df3..9d33807ec16d 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -149,17 +149,10 @@ static int
149nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys, 149nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys,
150 struct nlmsghdr *nlh, struct nfattr *cda[]) 150 struct nlmsghdr *nlh, struct nfattr *cda[])
151{ 151{
152 int min_len; 152 int min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
153 u_int16_t attr_count; 153 u_int16_t attr_count;
154 u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type); 154 u_int8_t cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type);
155 155
156 if (unlikely(cb_id >= subsys->cb_count))
157 return -EINVAL;
158
159 min_len = NLMSG_SPACE(sizeof(struct nfgenmsg));
160 if (unlikely(nlh->nlmsg_len < min_len))
161 return -EINVAL;
162
163 attr_count = subsys->cb[cb_id].attr_count; 156 attr_count = subsys->cb[cb_id].attr_count;
164 memset(cda, 0, sizeof(struct nfattr *) * attr_count); 157 memset(cda, 0, sizeof(struct nfattr *) * attr_count);
165 158