Commit f3278e3f authored by Kees Cook's avatar Kees Cook
Browse files

leds: Use struct_size() in allocation



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

Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 6566f907
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -237,8 +237,7 @@ static int cr0014114_probe(struct spi_device *spi)
		return -ENODEV;
		return -ENODEV;
	}
	}


	priv = devm_kzalloc(&spi->dev,
	priv = devm_kzalloc(&spi->dev, struct_size(priv, leds, count),
			    sizeof(*priv) + sizeof(*priv->leds) * count,
			    GFP_KERNEL);
			    GFP_KERNEL);
	if (!priv)
	if (!priv)
		return -ENOMEM;
		return -ENOMEM;