From: Kees Cook Date: Mon, 11 Jun 2018 23:31:49 +0000 (-0700) Subject: leds: Use struct_size() in allocation X-Git-Tag: v4.19~793^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3278e3f0ac42d07902d9a29d259eab7e108108a;p=platform%2Fkernel%2Flinux-rpi3.git leds: Use struct_size() in allocation This case got missed by the earlier treewide struct_size() conversions. Signed-off-by: Kees Cook --- diff --git a/drivers/leds/leds-cr0014114.c b/drivers/leds/leds-cr0014114.c index a4b1c1d..0e42624 100644 --- a/drivers/leds/leds-cr0014114.c +++ b/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;