]> git.ipfire.org Git - thirdparty/xtables-addons.git/commitdiff
xt_geoip: do not throw a warnings when country database is size 0
authorJan Engelhardt <jengelh@inai.de>
Thu, 30 May 2013 15:00:25 +0000 (17:00 +0200)
committerJan Engelhardt <jengelh@inai.de>
Thu, 30 May 2013 15:00:25 +0000 (17:00 +0200)
doc/changelog.txt
extensions/xt_geoip.c

index f39b11936613998f5c962a9315bbe2a496fda84c..56e03af66baed080fbd05721e46872de0889e4b4 100644 (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)
index 39ad0b29709587c74187a8ff262cfd56ce40ce45..e30c8270de38c36978103ee98a29a2de6ca7144e 100644 (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) {