* re: ACPI: Introduce CPU performance controls using CPPC
@ 2015-10-22 19:49 Dan Carpenter
2015-10-23 8:42 ` Ashwin Chaugule
2015-10-23 9:02 ` [PATCH] CPPC: Fix potential ptr leak Ashwin Chaugule
0 siblings, 2 replies; 6+ messages in thread
From: Dan Carpenter @ 2015-10-22 19:49 UTC (permalink / raw)
To: ashwin.chaugule; +Cc: linux-acpi
Hello Ashwin Chaugule,
The patch 337aadff8e45: "ACPI: Introduce CPU performance controls
using CPPC" from Oct 2, 2015, leads to the following static checker
warning:
drivers/acpi/cppc_acpi.c:527 acpi_cppc_processor_probe()
warn: overwrite may leak 'cpc_ptr'
drivers/acpi/cppc_acpi.c
426 cpc_ptr = kzalloc(sizeof(struct cpc_desc), GFP_KERNEL);
427 if (!cpc_ptr) {
428 ret = -ENOMEM;
429 goto out_buf_free;
430 }
431
432 /* First entry is NumEntries. */
433 cpc_obj = &out_obj->package.elements[0];
434 if (cpc_obj->type == ACPI_TYPE_INTEGER) {
435 num_ent = cpc_obj->integer.value;
436 } else {
437 pr_debug("Unexpected entry type(%d) for NumEntries\n",
438 cpc_obj->type);
439 goto out_free;
440 }
[ snip ]
523 kfree(output.pointer);
524 return 0;
525
526 out_free:
527 cpc_ptr = per_cpu(cpc_desc_ptr, pr->id);
Why do we have this line? Maybe it is left over and should be deleted?
528 kfree(cpc_ptr);
529
530 out_buf_free:
531 kfree(output.pointer);
532 return ret;
533 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ACPI: Introduce CPU performance controls using CPPC
2015-10-22 19:49 ACPI: Introduce CPU performance controls using CPPC Dan Carpenter
@ 2015-10-23 8:42 ` Ashwin Chaugule
2015-10-23 8:52 ` Dan Carpenter
2015-10-23 9:02 ` [PATCH] CPPC: Fix potential ptr leak Ashwin Chaugule
1 sibling, 1 reply; 6+ messages in thread
From: Ashwin Chaugule @ 2015-10-23 8:42 UTC (permalink / raw)
To: Dan Carpenter, Rafael Wysocki; +Cc: linux acpi
Hi Dan,
On 22 October 2015 at 15:49, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Hello Ashwin Chaugule,
>
> The patch 337aadff8e45: "ACPI: Introduce CPU performance controls
> using CPPC" from Oct 2, 2015, leads to the following static checker
> warning:
>
> drivers/acpi/cppc_acpi.c:527 acpi_cppc_processor_probe()
> warn: overwrite may leak 'cpc_ptr'
>
> drivers/acpi/cppc_acpi.c
> 426 cpc_ptr = kzalloc(sizeof(struct cpc_desc), GFP_KERNEL);
> 427 if (!cpc_ptr) {
> 428 ret = -ENOMEM;
> 429 goto out_buf_free;
> 430 }
> 431
> 432 /* First entry is NumEntries. */
> 433 cpc_obj = &out_obj->package.elements[0];
> 434 if (cpc_obj->type == ACPI_TYPE_INTEGER) {
> 435 num_ent = cpc_obj->integer.value;
> 436 } else {
> 437 pr_debug("Unexpected entry type(%d) for NumEntries\n",
> 438 cpc_obj->type);
> 439 goto out_free;
> 440 }
>
> [ snip ]
>
> 523 kfree(output.pointer);
> 524 return 0;
> 525
> 526 out_free:
> 527 cpc_ptr = per_cpu(cpc_desc_ptr, pr->id);
>
> Why do we have this line? Maybe it is left over and should be deleted?
Gah! You're right. This is a left over and should be deleted. I can
send the fix to Rafael, if you dont have one ready to send?
Thanks,
Ashwin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ACPI: Introduce CPU performance controls using CPPC
2015-10-23 8:42 ` Ashwin Chaugule
@ 2015-10-23 8:52 ` Dan Carpenter
2015-10-23 8:55 ` Ashwin Chaugule
0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2015-10-23 8:52 UTC (permalink / raw)
To: Ashwin Chaugule; +Cc: Rafael Wysocki, linux acpi
On Fri, Oct 23, 2015 at 04:42:14AM -0400, Ashwin Chaugule wrote:
> Gah! You're right. This is a left over and should be deleted. I can
> send the fix to Rafael, if you dont have one ready to send?
Can you send it? Please give me a Reported-by tag.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ACPI: Introduce CPU performance controls using CPPC
2015-10-23 8:52 ` Dan Carpenter
@ 2015-10-23 8:55 ` Ashwin Chaugule
0 siblings, 0 replies; 6+ messages in thread
From: Ashwin Chaugule @ 2015-10-23 8:55 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Rafael Wysocki, linux acpi
On 23 October 2015 at 04:52, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Fri, Oct 23, 2015 at 04:42:14AM -0400, Ashwin Chaugule wrote:
>> Gah! You're right. This is a left over and should be deleted. I can
>> send the fix to Rafael, if you dont have one ready to send?
>
> Can you send it? Please give me a Reported-by tag.
Sure. Will do.
Thanks,
Ashwin.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] CPPC: Fix potential ptr leak
2015-10-22 19:49 ACPI: Introduce CPU performance controls using CPPC Dan Carpenter
2015-10-23 8:42 ` Ashwin Chaugule
@ 2015-10-23 9:02 ` Ashwin Chaugule
2015-10-28 3:18 ` Rafael J. Wysocki
1 sibling, 1 reply; 6+ messages in thread
From: Ashwin Chaugule @ 2015-10-23 9:02 UTC (permalink / raw)
To: rafael, dan.carpenter; +Cc: linux-acpi, Ashwin Chaugule
The patch 337aadff8e45: "ACPI: Introduce CPU performance controls
using CPPC" from Oct 2, 2015, leads to the following static checker
warning:
drivers/acpi/cppc_acpi.c:527 acpi_cppc_processor_probe()
warn: overwrite may leak 'cpc_ptr'
Fix warning by removing bogus per cpu ptr dereference.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
---
drivers/acpi/cppc_acpi.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 0bbf84b..8ca4c2c 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -524,7 +524,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
return 0;
out_free:
- cpc_ptr = per_cpu(cpc_desc_ptr, pr->id);
kfree(cpc_ptr);
out_buf_free:
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] CPPC: Fix potential ptr leak
2015-10-23 9:02 ` [PATCH] CPPC: Fix potential ptr leak Ashwin Chaugule
@ 2015-10-28 3:18 ` Rafael J. Wysocki
0 siblings, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2015-10-28 3:18 UTC (permalink / raw)
To: Ashwin Chaugule; +Cc: rafael, dan.carpenter, linux-acpi
On Friday, October 23, 2015 05:02:52 AM Ashwin Chaugule wrote:
> The patch 337aadff8e45: "ACPI: Introduce CPU performance controls
> using CPPC" from Oct 2, 2015, leads to the following static checker
> warning:
>
> drivers/acpi/cppc_acpi.c:527 acpi_cppc_processor_probe()
> warn: overwrite may leak 'cpc_ptr'
>
> Fix warning by removing bogus per cpu ptr dereference.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
> ---
> drivers/acpi/cppc_acpi.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index 0bbf84b..8ca4c2c 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -524,7 +524,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
> return 0;
>
> out_free:
> - cpc_ptr = per_cpu(cpc_desc_ptr, pr->id);
> kfree(cpc_ptr);
>
> out_buf_free:
Applied, thanks!
Rafael
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-28 2:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-22 19:49 ACPI: Introduce CPU performance controls using CPPC Dan Carpenter
2015-10-23 8:42 ` Ashwin Chaugule
2015-10-23 8:52 ` Dan Carpenter
2015-10-23 8:55 ` Ashwin Chaugule
2015-10-23 9:02 ` [PATCH] CPPC: Fix potential ptr leak Ashwin Chaugule
2015-10-28 3:18 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).