]> err.no Git - linux-2.6/blobdiff - net/netfilter/nfnetlink.c
[PATCH] remove verify_area(): remove verify_area() from various uaccess.h headers
[linux-2.6] / net / netfilter / nfnetlink.c
index 578e4fe40945aa600e6f5bfb381cc4830c186181..49a3900e3d32b24d9ad91dc03340d62364d0ff25 100644 (file)
@@ -163,17 +163,16 @@ nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys,
                        cb_id, subsys->cb_count);
                return -EINVAL;
        }
-       
-       attr_count = subsys->cb[cb_id].attr_count;
-
-       memset(cda, 0, sizeof(struct nfattr *) * attr_count);
 
-       /* check attribute lengths. */
        min_len = NLMSG_ALIGN(sizeof(struct nfgenmsg));
-       if (nlh->nlmsg_len < min_len)
+       if (unlikely(nlh->nlmsg_len < min_len))
                return -EINVAL;
 
-       if (nlh->nlmsg_len > min_len) {
+       attr_count = subsys->cb[cb_id].attr_count;
+       memset(cda, 0, sizeof(struct nfattr *) * attr_count);
+
+       /* check attribute lengths. */
+       if (likely(nlh->nlmsg_len > min_len)) {
                struct nfattr *attr = NFM_NFA(NLMSG_DATA(nlh));
                int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len);
 
@@ -186,8 +185,10 @@ nfnetlink_check_attributes(struct nfnetlink_subsystem *subsys,
                        }
                        attr = NFA_NEXT(attr, attrlen);
                }
-       } else
-               return -EINVAL;
+       }
+
+       /* implicit: if nlmsg_len == min_len, we return 0, and an empty
+        * (zeroed) cda[] array. The message is valid, but empty. */
 
         return 0;
 }
@@ -197,7 +198,7 @@ int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo)
        int allocation = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
        int err = 0;
 
-       NETLINK_CB(skb).dst_groups = group;
+       NETLINK_CB(skb).dst_group = group;
        if (echo)
                atomic_inc(&skb->users);
        netlink_broadcast(nfnl, skb, pid, group, allocation);
@@ -343,19 +344,19 @@ static void nfnetlink_rcv(struct sock *sk, int len)
        } while(nfnl && nfnl->sk_receive_queue.qlen);
 }
 
-void __exit nfnetlink_exit(void)
+static void __exit nfnetlink_exit(void)
 {
        printk("Removing netfilter NETLINK layer.\n");
        sock_release(nfnl->sk_socket);
        return;
 }
 
-int __init nfnetlink_init(void)
+static int __init nfnetlink_init(void)
 {
        printk("Netfilter messages via NETLINK v%s.\n", nfversion);
 
-       nfnl = netlink_kernel_create(NETLINK_NETFILTER, nfnetlink_rcv,
-                                    THIS_MODULE);
+       nfnl = netlink_kernel_create(NETLINK_NETFILTER, NFNLGRP_MAX,
+                                    nfnetlink_rcv, THIS_MODULE);
        if (!nfnl) {
                printk(KERN_ERR "cannot initialize nfnetlink!\n");
                return -1;