Skip to content

Commit af6cc45

Browse files
ethancedwards8vireshk
authored andcommitted
cpufreq: sparc: change kzalloc to kcalloc
Refactor to use kcalloc instead of kzalloc when multiplying allocation size by count. This refactor prevents unintentional memory overflows. Discovered by checkpatch.pl. Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent a9ba290 commit af6cc45

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/cpufreq/sparc-us2e-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ static int __init us2e_freq_init(void)
323323
impl = ((ver >> 32) & 0xffff);
324324

325325
if (manuf == 0x17 && impl == 0x13) {
326-
us2e_freq_table = kzalloc(NR_CPUS * sizeof(*us2e_freq_table),
326+
us2e_freq_table = kcalloc(NR_CPUS, sizeof(*us2e_freq_table),
327327
GFP_KERNEL);
328328
if (!us2e_freq_table)
329329
return -ENOMEM;

drivers/cpufreq/sparc-us3-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static int __init us3_freq_init(void)
171171
impl == CHEETAH_PLUS_IMPL ||
172172
impl == JAGUAR_IMPL ||
173173
impl == PANTHER_IMPL)) {
174-
us3_freq_table = kzalloc(NR_CPUS * sizeof(*us3_freq_table),
174+
us3_freq_table = kcalloc(NR_CPUS, sizeof(*us3_freq_table),
175175
GFP_KERNEL);
176176
if (!us3_freq_table)
177177
return -ENOMEM;

0 commit comments

Comments
 (0)