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

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>

authored by

Ethan Carter Edwards and committed by
Viresh Kumar
af6cc45a a9ba290d

+2 -2
+1 -1
drivers/cpufreq/sparc-us2e-cpufreq.c
··· 323 323 impl = ((ver >> 32) & 0xffff); 324 324 325 325 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), 327 327 GFP_KERNEL); 328 328 if (!us2e_freq_table) 329 329 return -ENOMEM;
+1 -1
drivers/cpufreq/sparc-us3-cpufreq.c
··· 171 171 impl == CHEETAH_PLUS_IMPL || 172 172 impl == JAGUAR_IMPL || 173 173 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), 175 175 GFP_KERNEL); 176 176 if (!us3_freq_table) 177 177 return -ENOMEM;