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 <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240814125513.2637955-3-andriy.shevchenko@linux.intel.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 0da7fac commit 1b2ed9d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • drivers/clk/visconti

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)