]> Git Repo - linux.git/commitdiff
cpufreq: sparc: change kzalloc to kcalloc
authorEthan Carter Edwards <[email protected]>
Mon, 23 Dec 2024 14:41:24 +0000 (14:41 +0000)
committerViresh Kumar <[email protected]>
Tue, 24 Dec 2024 04:18:58 +0000 (09:48 +0530)
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 <[email protected]>
Signed-off-by: Viresh Kumar <[email protected]>
drivers/cpufreq/sparc-us2e-cpufreq.c
drivers/cpufreq/sparc-us3-cpufreq.c

index 8a0cd5312a593ae648a39a343a7a6b4ef78bcbe8..15899dd77c086aff442f834220d587b14720de06 100644 (file)
@@ -323,7 +323,7 @@ static int __init us2e_freq_init(void)
        impl  = ((ver >> 32) & 0xffff);
 
        if (manuf == 0x17 && impl == 0x13) {
-               us2e_freq_table = kzalloc(NR_CPUS * sizeof(*us2e_freq_table),
+               us2e_freq_table = kcalloc(NR_CPUS, sizeof(*us2e_freq_table),
                                          GFP_KERNEL);
                if (!us2e_freq_table)
                        return -ENOMEM;
index b50f9d13e6d266f5ecbea5042dec5c9b08dadcab..de50a2f3b12451b62b0856d2a18032c4971b7500 100644 (file)
@@ -171,7 +171,7 @@ static int __init us3_freq_init(void)
             impl == CHEETAH_PLUS_IMPL ||
             impl == JAGUAR_IMPL ||
             impl == PANTHER_IMPL)) {
-               us3_freq_table = kzalloc(NR_CPUS * sizeof(*us3_freq_table),
+               us3_freq_table = kcalloc(NR_CPUS, sizeof(*us3_freq_table),
                                         GFP_KERNEL);
                if (!us3_freq_table)
                        return -ENOMEM;
This page took 0.062532 seconds and 4 git commands to generate.