Skip to content

Commit f3278e3

Browse files
committed
leds: Use struct_size() in allocation
This case got missed by the earlier treewide struct_size() conversions. Signed-off-by: Kees Cook <[email protected]>
1 parent 6566f90 commit f3278e3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/leds/leds-cr0014114.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ static int cr0014114_probe(struct spi_device *spi)
237237
return -ENODEV;
238238
}
239239

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

0 commit comments

Comments
 (0)