mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Colin King <colin.king@canonical.com>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Lukasz Luba <lukasz.luba@arm.com>,
	linux-pm@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] powercap/drivers/dtpm: Fix size of object being allocated
Date: Mon, 4 Jan 2021 15:23:44 +0100	[thread overview]
Message-ID: <ea95f420-2a2e-d0f9-9b34-e329d80bbd9d@linaro.org> (raw)
In-Reply-To: <20210104121053.33210-1-colin.king@canonical.com>

On 04/01/2021 13:10, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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>

Good catch, thanks for fixing this

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>

> ---
>  drivers/powercap/dtpm_cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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;
>  
> 


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

  reply	other threads:[~2021-01-04 14:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 12:10 Colin King
2021-01-04 14:23 ` Daniel Lezcano [this message]
2021-01-07 17:20   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea95f420-2a2e-d0f9-9b34-e329d80bbd9d@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=colin.king@canonical.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®