From d48a5fe0f43c3f34916bf4798159e5be4320cf58 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 30 May 2013 17:00:25 +0200 Subject: [PATCH] xt_geoip: do not throw a warnings when country database is size 0 --- doc/changelog.txt | 1 + extensions/xt_geoip.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index f39b119..56e03af 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -3,6 +3,7 @@ HEAD ==== Fixes: - xt_RAWNAT: ensure correct operation in the presence of IPv4 options +- xt_geoip: do not throw a warnings when country database is size 0 v2.2 (2013-03-31) diff --git a/extensions/xt_geoip.c b/extensions/xt_geoip.c index 39ad0b2..e30c827 100644 --- a/extensions/xt_geoip.c +++ b/extensions/xt_geoip.c @@ -83,10 +83,18 @@ geoip_add_node(const struct geoip_country_user __user *umem_ptr, p->count = umem.count; p->cc = umem.cc; size = p->count * geoproto_size[proto]; - subnet = vmalloc(size); - if (subnet == NULL) { - ret = -ENOMEM; - goto free_p; + if (size == 0) { + /* + * Believe it or not, vmalloc prints a warning to dmesg for + * zero-sized allocations :-/ + */ + subnet = NULL; + } else { + subnet = vmalloc(size); + if (subnet == NULL) { + ret = -ENOMEM; + goto free_p; + } } if (copy_from_user(subnet, (const void __user *)(unsigned long)umem.subnets, size) != 0) { -- 2.47.3