Skip to content

Commit 1b2ed9d

Browse files
andy-shevbebarino
authored andcommitted
clk: visconti: Switch to use kmemdup_array()
Let the kmemdup_array() take care about multiplication and possible overflows. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 0da7fac commit 1b2ed9d

File tree

1 file changed

+3
-3
lines changed
  • drivers/clk/visconti

1 file changed

+3
-3
lines changed

drivers/clk/visconti/pll.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ static struct clk_hw *visconti_register_pll(struct visconti_pll_provider *ctx,
262262
for (len = 0; rate_table[len].rate != 0; )
263263
len++;
264264
pll->rate_count = len;
265-
pll->rate_table = kmemdup(rate_table,
266-
pll->rate_count * sizeof(struct visconti_pll_rate_table),
267-
GFP_KERNEL);
265+
pll->rate_table = kmemdup_array(rate_table,
266+
pll->rate_count, sizeof(*pll->rate_table),
267+
GFP_KERNEL);
268268
WARN(!pll->rate_table, "%s: could not allocate rate table for %s\n", __func__, name);
269269

270270
init.ops = &visconti_pll_ops;

0 commit comments

Comments
 (0)