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) {