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>
This commit is contained in:
Kees Cook 2018-06-11 16:31:49 -07:00
parent 6566f907bf
commit f3278e3f0a

View File

@ -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;