params: Use size_add() for kmalloc()
[linux-2.6-block.git] / kernel / params.c
index f8e3c413985407cd2ff8e6088172727605d6ef8c..c3a029fe183d33ca085ff8aaaef07d0622ad6e18 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/moduleparam.h>
 #include <linux/device.h>
 #include <linux/err.h>
+#include <linux/overflow.h>
 #include <linux/slab.h>
 #include <linux/ctype.h>
 #include <linux/security.h>
@@ -48,7 +49,7 @@ static void *kmalloc_parameter(unsigned int size)
 {
        struct kmalloced_param *p;
 
-       p = kmalloc(sizeof(*p) + size, GFP_KERNEL);
+       p = kmalloc(size_add(sizeof(*p), size), GFP_KERNEL);
        if (!p)
                return NULL;