diff options
author | Colin Ian King <colin.king@canonical.com> | 2021-01-04 12:10:53 +0000 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-01-07 18:16:03 +0100 |
commit | 66e713fbbbc6c259559d4937a3b016d36ab529ff (patch) | |
tree | 8a78fb8439a51663eadee79912d9e94bb6ef7bc8 /drivers/powercap | |
parent | f8f706ad75abbc65fee365853e7b24731223fd6d (diff) |
powercap/drivers/dtpm: Fix size of object being allocated
The kzalloc allocation for dtpm_cpu is currently allocating the size
of the pointer and not the size of the structure. Fix this by using
the correct sizeof argument.
Addresses-Coverity: ("Wrong sizeof argument")
Fixes: 0e8f68d7f048 ("powercap/drivers/dtpm: Add CPU energy model based support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/powercap')
-rw-r--r-- | drivers/powercap/dtpm_cpu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c index 6933c783c6b4..51c366938acd 100644 --- a/drivers/powercap/dtpm_cpu.c +++ b/drivers/powercap/dtpm_cpu.c @@ -200,7 +200,7 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu) if (!dtpm) return -EINVAL; - dtpm_cpu = kzalloc(sizeof(dtpm_cpu), GFP_KERNEL); + dtpm_cpu = kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL); if (!dtpm_cpu) goto out_kfree_dtpm; |