Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

OPP: switch to use kmemdup_array()

Use kmemdup_array() to avoid multiplication and possible overflows.

Signed-off-by: Zhang Enpei <zhang.enpei@zte.com.cn>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

authored by

Zhang Enpei and committed by
Viresh Kumar
03eadcbd ee3de3cf

+2 -2
+2 -2
drivers/opp/core.c
··· 2087 2087 if (opp_table->supported_hw) 2088 2088 return 0; 2089 2089 2090 - opp_table->supported_hw = kmemdup(versions, count * sizeof(*versions), 2091 - GFP_KERNEL); 2090 + opp_table->supported_hw = kmemdup_array(versions, count, 2091 + sizeof(*versions), GFP_KERNEL); 2092 2092 if (!opp_table->supported_hw) 2093 2093 return -ENOMEM; 2094 2094