compat: handle fail of vmalloc()
authorHauke Mehrtens <hauke@hauke-m.de>
Wed, 27 Apr 2011 19:01:22 +0000 (21:01 +0200)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Wed, 27 Apr 2011 19:56:49 +0000 (12:56 -0700)
Only memset the memory if we get a valid pointer.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
compat/compat-2.6.37.c

index c49efeaf26e18af32af16aa229b9b25aff2b3761..8698e1dcbf0ffd3babeefeea472eaf6f7bf12bf0 100644 (file)
@@ -348,7 +348,8 @@ void *vzalloc(unsigned long size)
 {
        void *buf;
        buf = vmalloc(size);
-       memset(buf, 0, size);
+       if (buf)
+               memset(buf, 0, size);
        return buf;
 }
 EXPORT_SYMBOL(vzalloc);