xt_geoip: do not throw a warnings when country database is size 0

This commit is contained in:
Jan Engelhardt
2013-05-30 17:00:25 +02:00
parent b70905e7cb
commit d48a5fe0f4
2 changed files with 13 additions and 4 deletions

View File

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

View File

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