UPSTREAM: 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> Link: https://www.spinics.net/lists/linux-kernel-janitors/msg56960.html Bug: 182396925 Change-Id: Iac5e069ca027136d85089b8eab9ba6dfe10034b7 (cherry picked from commit 66e713fbbbc6c259559d4937a3b016d36ab529ff) Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
fd2c659694
commit
5f1e1f42a5
@@ -200,7 +200,7 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu)
|
|||||||
if (!dtpm)
|
if (!dtpm)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
dtpm_cpu = kzalloc(sizeof(dtpm_cpu), GFP_KERNEL);
|
dtpm_cpu = kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL);
|
||||||
if (!dtpm_cpu)
|
if (!dtpm_cpu)
|
||||||
goto out_kfree_dtpm;
|
goto out_kfree_dtpm;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user