Skip to content

Commit

Permalink
powercap/drivers/dtpm: Fix size of object being allocated
Browse files Browse the repository at this point in the history
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: 0e8f68d ("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>
  • Loading branch information
Colin Ian King authored and rafaeljw committed Jan 7, 2021
1 parent f8f706a commit 66e713f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/powercap/dtpm_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 66e713f

Please sign in to comment.