netfilter: Remove unnecessary OOM logging messages
authorJoe Perches <joe@perches.com>
Mon, 29 Aug 2011 21:17:25 +0000 (14:17 -0700)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 1 Nov 2011 08:19:49 +0000 (09:19 +0100)
Site specific OOM messages are duplications of a generic MM
out of memory message and aren't really useful, so just
delete them.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
18 files changed:
net/bridge/netfilter/ebt_ulog.c
net/ipv4/netfilter/ipt_CLUSTERIP.c
net/ipv4/netfilter/ipt_ULOG.c
net/ipv4/netfilter/nf_nat_snmp_basic.c
net/ipv6/netfilter/nf_conntrack_reasm.c
net/netfilter/ipset/ip_set_core.c
net/netfilter/ipvs/ip_vs_core.c
net/netfilter/ipvs/ip_vs_ctl.c
net/netfilter/ipvs/ip_vs_dh.c
net/netfilter/ipvs/ip_vs_lblc.c
net/netfilter/ipvs/ip_vs_lblcr.c
net/netfilter/ipvs/ip_vs_proto.c
net/netfilter/ipvs/ip_vs_sh.c
net/netfilter/ipvs/ip_vs_wrr.c
net/netfilter/nf_conntrack_core.c
net/netfilter/nfnetlink_log.c
net/netfilter/xt_IDLETIMER.c
net/netfilter/xt_hashlimit.c

index bf2a333ca7c7651812f5318d644d19d185efff61..5449294bdd5e7babc41b20d5bfcb523d97b74e1d 100644 (file)
@@ -102,16 +102,15 @@ static struct sk_buff *ulog_alloc_skb(unsigned int size)
        unsigned int n;
 
        n = max(size, nlbufsiz);
-       skb = alloc_skb(n, GFP_ATOMIC);
+       skb = alloc_skb(n, GFP_ATOMIC | __GFP_NOWARN);
        if (!skb) {
-               pr_debug("cannot alloc whole buffer of size %ub!\n", n);
                if (n > size) {
                        /* try to allocate only as much as we need for
                         * current packet */
                        skb = alloc_skb(size, GFP_ATOMIC);
                        if (!skb)
-                               pr_debug("cannot even allocate "
-                                        "buffer of size %ub\n", size);
+                               pr_debug("cannot even allocate buffer of size %ub\n",
+                                        size);
                }
        }
 
index db8d22db425f6917b23d8d31661905ab58d3ef2d..a639967eb727284a668354374d9bc4103a7ca1d9 100644 (file)
@@ -395,7 +395,6 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
                        config = clusterip_config_init(cipinfo,
                                                        e->ip.dst.s_addr, dev);
                        if (!config) {
-                               pr_info("cannot allocate config\n");
                                dev_put(dev);
                                return -ENOMEM;
                        }
index 446e0f467a17eed968b7a9cba12b001b05de1154..b5508151e5476a23d3285b2bf919dba3132bc322 100644 (file)
@@ -135,10 +135,8 @@ static struct sk_buff *ulog_alloc_skb(unsigned int size)
         * due to slab allocator restrictions */
 
        n = max(size, nlbufsiz);
-       skb = alloc_skb(n, GFP_ATOMIC);
+       skb = alloc_skb(n, GFP_ATOMIC | __GFP_NOWARN);
        if (!skb) {
-               pr_debug("cannot alloc whole buffer %ub!\n", n);
-
                if (n > size) {
                        /* try to allocate only as much as we need for
                         * current packet */
index d1cb412c18e02665db35e95021f29ecae38bf35c..2133c30a4a5f4799be74c729dac78a9b579c6101 100644 (file)
@@ -400,11 +400,8 @@ static unsigned char asn1_octets_decode(struct asn1_ctx *ctx,
        *len = 0;
 
        *octets = kmalloc(eoc - ctx->pointer, GFP_ATOMIC);
-       if (*octets == NULL) {
-               if (net_ratelimit())
-                       pr_notice("OOM in bsalg (%d)\n", __LINE__);
+       if (*octets == NULL)
                return 0;
-       }
 
        ptr = *octets;
        while (ctx->pointer < eoc) {
@@ -451,11 +448,8 @@ static unsigned char asn1_oid_decode(struct asn1_ctx *ctx,
                return 0;
 
        *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
-       if (*oid == NULL) {
-               if (net_ratelimit())
-                       pr_notice("OOM in bsalg (%d)\n", __LINE__);
+       if (*oid == NULL)
                return 0;
-       }
 
        optr = *oid;
 
@@ -728,8 +722,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
                *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
                if (*obj == NULL) {
                        kfree(id);
-                       if (net_ratelimit())
-                               pr_notice("OOM in bsalg (%d)\n", __LINE__);
                        return 0;
                }
                (*obj)->syntax.l[0] = l;
@@ -744,8 +736,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
                if (*obj == NULL) {
                        kfree(p);
                        kfree(id);
-                       if (net_ratelimit())
-                               pr_notice("OOM in bsalg (%d)\n", __LINE__);
                        return 0;
                }
                memcpy((*obj)->syntax.c, p, len);
@@ -759,8 +749,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
                *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC);
                if (*obj == NULL) {
                        kfree(id);
-                       if (net_ratelimit())
-                               pr_notice("OOM in bsalg (%d)\n", __LINE__);
                        return 0;
                }
                if (!asn1_null_decode(ctx, end)) {
@@ -780,8 +768,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
                if (*obj == NULL) {
                        kfree(lp);
                        kfree(id);
-                       if (net_ratelimit())
-                               pr_notice("OOM in bsalg (%d)\n", __LINE__);
                        return 0;
                }
                memcpy((*obj)->syntax.ul, lp, len);
@@ -801,8 +787,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
                if (*obj == NULL) {
                        kfree(p);
                        kfree(id);
-                       if (net_ratelimit())
-                               pr_notice("OOM in bsalg (%d)\n", __LINE__);
                        return 0;
                }
                memcpy((*obj)->syntax.uc, p, len);
@@ -819,8 +803,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
                *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
                if (*obj == NULL) {
                        kfree(id);
-                       if (net_ratelimit())
-                               pr_notice("OOM in bsalg (%d)\n", __LINE__);
                        return 0;
                }
                (*obj)->syntax.ul[0] = ul;
index e8762c73b170f3c73f675e7b49d6a13c5d3a6174..38f00b0298d3f53327f2e35447e8ab97a1568e83 100644 (file)
@@ -182,7 +182,6 @@ fq_find(__be32 id, u32 user, struct in6_addr *src, struct in6_addr *dst)
        return container_of(q, struct nf_ct_frag6_queue, q);
 
 oom:
-       pr_debug("Can't alloc new queue\n");
        return NULL;
 }
 
@@ -370,10 +369,10 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
                struct sk_buff *clone;
                int i, plen = 0;
 
-               if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL) {
-                       pr_debug("Can't alloc skb\n");
+               clone = alloc_skb(0, GFP_ATOMIC);
+               if (clone == NULL)
                        goto out_oom;
-               }
+
                clone->next = head->next;
                head->next = clone;
                skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
index d7e86ef9d23aa0a11fbd5d80a8f64e4a01c7a8ea..86137b558f455d9e1740a977aa09ea1e294bb241 100644 (file)
@@ -1699,10 +1699,8 @@ ip_set_init(void)
 
        ip_set_list = kzalloc(sizeof(struct ip_set *) * ip_set_max,
                              GFP_KERNEL);
-       if (!ip_set_list) {
-               pr_err("ip_set: Unable to create ip_set_list\n");
+       if (!ip_set_list)
                return -ENOMEM;
-       }
 
        ret = nfnetlink_subsys_register(&ip_set_netlink_subsys);
        if (ret != 0) {
index 00ea1ad00c04d07ab618d87bd71f36b7e2f515fd..46a8130d3f42ba2f2621fdca4ce33f5170c0056d 100644 (file)
@@ -1877,10 +1877,9 @@ static int __net_init __ip_vs_init(struct net *net)
        struct netns_ipvs *ipvs;
 
        ipvs = net_generic(net, ip_vs_net_id);
-       if (ipvs == NULL) {
-               pr_err("%s(): no memory.\n", __func__);
+       if (ipvs == NULL)
                return -ENOMEM;
-       }
+
        /* Hold the beast until a service is registerd */
        ipvs->enable = 0;
        ipvs->net = net;
index 993935c0e472b3cb98faed9bb42d0c5c37d8ebc2..008bf97cc91a58b14a0ef9fd6924eb6f71063f11 100644 (file)
@@ -856,15 +856,12 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
        }
 
        dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL);
-       if (dest == NULL) {
-               pr_err("%s(): no memory.\n", __func__);
+       if (dest == NULL)
                return -ENOMEM;
-       }
+
        dest->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
-       if (!dest->stats.cpustats) {
-               pr_err("%s() alloc_percpu failed\n", __func__);
+       if (!dest->stats.cpustats)
                goto err_alloc;
-       }
 
        dest->af = svc->af;
        dest->protocol = svc->protocol;
@@ -1168,10 +1165,8 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
                goto out_err;
        }
        svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
-       if (!svc->stats.cpustats) {
-               pr_err("%s() alloc_percpu failed\n", __func__);
+       if (!svc->stats.cpustats)
                goto out_err;
-       }
 
        /* I'm the first user of the service */
        atomic_set(&svc->usecnt, 0);
@@ -3716,10 +3711,9 @@ int __net_init ip_vs_control_net_init(struct net *net)
 
        /* procfs stats */
        ipvs->tot_stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
-       if (!ipvs->tot_stats.cpustats) {
-               pr_err("%s(): alloc_percpu.\n", __func__);
+       if (!ipvs->tot_stats.cpustats)
                return -ENOMEM;
-       }
+
        spin_lock_init(&ipvs->tot_stats.lock);
 
        proc_net_fops_create(net, "ip_vs", 0, &ip_vs_info_fops);
index 95fd0d14200b338a41e0a580e890e85ea5ec5e1e..1c269e56200ad2e67b49cf97dd7a04d78aa019dc 100644 (file)
@@ -150,10 +150,9 @@ static int ip_vs_dh_init_svc(struct ip_vs_service *svc)
        /* allocate the DH table for this service */
        tbl = kmalloc(sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE,
                      GFP_ATOMIC);
-       if (tbl == NULL) {
-               pr_err("%s(): no memory\n", __func__);
+       if (tbl == NULL)
                return -ENOMEM;
-       }
+
        svc->sched_data = tbl;
        IP_VS_DBG(6, "DH hash table (memory=%Zdbytes) allocated for "
                  "current service\n",
index 87e40ea77a95244e6ca94c21c9475ed296e21d1b..0f16283fd05854fccc68fad349c7f29509926252 100644 (file)
@@ -202,10 +202,8 @@ ip_vs_lblc_new(struct ip_vs_lblc_table *tbl, const union nf_inet_addr *daddr,
        en = ip_vs_lblc_get(dest->af, tbl, daddr);
        if (!en) {
                en = kmalloc(sizeof(*en), GFP_ATOMIC);
-               if (!en) {
-                       pr_err("%s(): no memory\n", __func__);
+               if (!en)
                        return NULL;
-               }
 
                en->af = dest->af;
                ip_vs_addr_copy(dest->af, &en->addr, daddr);
@@ -345,10 +343,9 @@ static int ip_vs_lblc_init_svc(struct ip_vs_service *svc)
         *    Allocate the ip_vs_lblc_table for this service
         */
        tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC);
-       if (tbl == NULL) {
-               pr_err("%s(): no memory\n", __func__);
+       if (tbl == NULL)
                return -ENOMEM;
-       }
+
        svc->sched_data = tbl;
        IP_VS_DBG(6, "LBLC hash table (memory=%Zdbytes) allocated for "
                  "current service\n", sizeof(*tbl));
index 90f618ab6ddac3b04fe118c3573cf0fad779f744..eec797f8cce705a1676caeb3c3078053ddcdf523 100644 (file)
@@ -112,10 +112,8 @@ ip_vs_dest_set_insert(struct ip_vs_dest_set *set, struct ip_vs_dest *dest)
        }
 
        e = kmalloc(sizeof(*e), GFP_ATOMIC);
-       if (e == NULL) {
-               pr_err("%s(): no memory\n", __func__);
+       if (e == NULL)
                return NULL;
-       }
 
        atomic_inc(&dest->refcnt);
        e->dest = dest;
@@ -373,10 +371,8 @@ ip_vs_lblcr_new(struct ip_vs_lblcr_table *tbl, const union nf_inet_addr *daddr,
        en = ip_vs_lblcr_get(dest->af, tbl, daddr);
        if (!en) {
                en = kmalloc(sizeof(*en), GFP_ATOMIC);
-               if (!en) {
-                       pr_err("%s(): no memory\n", __func__);
+               if (!en)
                        return NULL;
-               }
 
                en->af = dest->af;
                ip_vs_addr_copy(dest->af, &en->addr, daddr);
@@ -516,10 +512,9 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
         *    Allocate the ip_vs_lblcr_table for this service
         */
        tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC);
-       if (tbl == NULL) {
-               pr_err("%s(): no memory\n", __func__);
+       if (tbl == NULL)
                return -ENOMEM;
-       }
+
        svc->sched_data = tbl;
        IP_VS_DBG(6, "LBLCR hash table (memory=%Zdbytes) allocated for "
                  "current service\n", sizeof(*tbl));
index 52d073c105e9ee7af155b1a9439017e9bc74b414..85312939695f86f59357039799cb14364e1f638e 100644 (file)
@@ -74,10 +74,9 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp)
        struct ip_vs_proto_data *pd =
                        kzalloc(sizeof(struct ip_vs_proto_data), GFP_ATOMIC);
 
-       if (!pd) {
-               pr_err("%s(): no memory.\n", __func__);
+       if (!pd)
                return -ENOMEM;
-       }
+
        pd->pp = pp;    /* For speed issues */
        pd->next = ipvs->proto_data_table[hash];
        ipvs->proto_data_table[hash] = pd;
index b5e2556c581ad4c7ddabad5807d6af2d50add98f..33815f4fb451c42aeb0dad99cf157c37cc32dfbf 100644 (file)
@@ -147,10 +147,9 @@ static int ip_vs_sh_init_svc(struct ip_vs_service *svc)
        /* allocate the SH table for this service */
        tbl = kmalloc(sizeof(struct ip_vs_sh_bucket)*IP_VS_SH_TAB_SIZE,
                      GFP_ATOMIC);
-       if (tbl == NULL) {
-               pr_err("%s(): no memory\n", __func__);
+       if (tbl == NULL)
                return -ENOMEM;
-       }
+
        svc->sched_data = tbl;
        IP_VS_DBG(6, "SH hash table (memory=%Zdbytes) allocated for "
                  "current service\n",
index 1ef41f50723c04c13cfcff46ac1ca387aa6def7a..fd0d4e09876a6177d167af378ef503f6ca64d6a8 100644 (file)
@@ -85,10 +85,9 @@ static int ip_vs_wrr_init_svc(struct ip_vs_service *svc)
         *    Allocate the mark variable for WRR scheduling
         */
        mark = kmalloc(sizeof(struct ip_vs_wrr_mark), GFP_ATOMIC);
-       if (mark == NULL) {
-               pr_err("%s(): no memory\n", __func__);
+       if (mark == NULL)
                return -ENOMEM;
-       }
+
        mark->cl = &svc->destinations;
        mark->cw = 0;
        mark->mw = ip_vs_wrr_max_weight(svc);
index 5acfaf59a9c3c26547f001d453ebd9a00a912f77..7202b0631cd6eb725debc17062a0d1f4a1087f41 100644 (file)
@@ -661,7 +661,6 @@ __nf_conntrack_alloc(struct net *net, u16 zone,
         */
        ct = kmem_cache_alloc(net->ct.nf_conntrack_cachep, gfp);
        if (ct == NULL) {
-               pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n");
                atomic_dec(&net->ct.count);
                return ERR_PTR(-ENOMEM);
        }
@@ -749,10 +748,8 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
 
        ct = __nf_conntrack_alloc(net, zone, tuple, &repl_tuple, GFP_ATOMIC,
                                  hash);
-       if (IS_ERR(ct)) {
-               pr_debug("Can't allocate conntrack.\n");
+       if (IS_ERR(ct))
                return (struct nf_conntrack_tuple_hash *)ct;
-       }
 
        if (!l4proto->new(ct, skb, dataoff)) {
                nf_conntrack_free(ct);
index 2d8158acf6faf5298c84e4fdabc6d8f9847b737b..66b2c54c544f6bbf87c20500d97452122f2b2fcf 100644 (file)
@@ -307,17 +307,14 @@ nfulnl_alloc_skb(unsigned int inst_size, unsigned int pkt_size)
        n = max(inst_size, pkt_size);
        skb = alloc_skb(n, GFP_ATOMIC);
        if (!skb) {
-               pr_notice("nfnetlink_log: can't alloc whole buffer (%u bytes)\n",
-                       inst_size);
-
                if (n > pkt_size) {
                        /* try to allocate only as much as we need for current
                         * packet */
 
                        skb = alloc_skb(pkt_size, GFP_ATOMIC);
                        if (!skb)
-                               pr_err("nfnetlink_log: can't even alloc %u "
-                                      "bytes\n", pkt_size);
+                               pr_err("nfnetlink_log: can't even alloc %u bytes\n",
+                                      pkt_size);
                }
        }
 
index 3bdd443aaf154d7946abdd802bd080df4e2c8fad..f407ebc13481ae5caa0f634db643d034c7af7e6a 100644 (file)
@@ -122,14 +122,12 @@ static int idletimer_tg_create(struct idletimer_tg_info *info)
 
        info->timer = kmalloc(sizeof(*info->timer), GFP_KERNEL);
        if (!info->timer) {
-               pr_debug("couldn't alloc timer\n");
                ret = -ENOMEM;
                goto out;
        }
 
        info->timer->attr.attr.name = kstrdup(info->label, GFP_KERNEL);
        if (!info->timer->attr.attr.name) {
-               pr_debug("couldn't alloc attribute name\n");
                ret = -ENOMEM;
                goto out_free_timer;
        }
index 9228ee0dc11a307a49d131e7f879c738351dcef5..dfd52bad1523f73535110e0d1b2c9f4a87c6545a 100644 (file)
@@ -176,10 +176,7 @@ dsthash_alloc_init(struct xt_hashlimit_htable *ht,
                ent = NULL;
        } else
                ent = kmem_cache_alloc(hashlimit_cachep, GFP_ATOMIC);
-       if (!ent) {
-               if (net_ratelimit())
-                       pr_err("cannot allocate dsthash_ent\n");
-       } else {
+       if (ent) {
                memcpy(&ent->dst, dst, sizeof(ent->dst));
                spin_lock_init(&ent->lock);