treewide: Use struct_size() for kmalloc()-family
[linux-2.6-microblaze.git] / drivers / input / input-leds.c
index 5f04b2d..99cc784 100644 (file)
@@ -98,8 +98,7 @@ static int input_leds_connect(struct input_handler *handler,
        if (!num_leds)
                return -ENXIO;
 
-       leds = kzalloc(sizeof(*leds) + num_leds * sizeof(*leds->leds),
-                      GFP_KERNEL);
+       leds = kzalloc(struct_size(leds, leds, num_leds), GFP_KERNEL);
        if (!leds)
                return -ENOMEM;