Skip to content

Commit

Permalink
leds: Use struct_size() in allocation
Browse files Browse the repository at this point in the history
This case got missed by the earlier treewide struct_size() conversions.

Signed-off-by: Kees Cook <keescook@chromium.org>
  • Loading branch information
Kees Cook committed Jun 12, 2018
1 parent 6566f90 commit f3278e3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/leds/leds-cr0014114.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f3278e3

Please sign in to comment.