Browse Source

leds: Use struct_size() in allocation

This case got missed by the earlier treewide struct_size() conversions.

Signed-off-by: Kees Cook <keescook@chromium.org>
Kees Cook 7 years ago
parent
commit
f3278e3f0a
1 changed files with 1 additions and 2 deletions
  1. 1 2
      drivers/leds/leds-cr0014114.c

+ 1 - 2
drivers/leds/leds-cr0014114.c

@@ -237,8 +237,7 @@ static int cr0014114_probe(struct spi_device *spi)
 		return -ENODEV;
 	}
 
-	priv = devm_kzalloc(&spi->dev,
-			    sizeof(*priv) + sizeof(*priv->leds) * count,
+	priv = devm_kzalloc(&spi->dev, struct_size(priv, leds, count),
 			    GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;