Linux-ACPI Archive mirror
 help / color / mirror / Atom feed
* [patch] power_meter: acpi_device_class "power_meter_resource" too long
@ 2010-03-19 11:49 Dan Carpenter
  2010-03-22 18:13 ` Darrick J. Wong
  2010-03-23 16:26 ` Thomas Renninger
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2010-03-19 11:49 UTC (permalink / raw
  To: Len Brown
  Cc: Darrick J. Wong, Andrew Morton, Márton Németh, Lin Ming,
	linux-acpi, linux-kernel, kernel-janitors

acpi_device_class can only be 19 characters and a NULL terminator.

The current code has a buffer overflow in acpi_power_meter_add():
       strcpy(acpi_device_class(device), ACPI_POWER_METER_CLASS);

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Feel free to change the name to anything you like.

diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c
index 834c5af..31baa1e 100644
--- a/drivers/acpi/power_meter.c
+++ b/drivers/acpi/power_meter.c
@@ -34,7 +34,7 @@
 #define ACPI_POWER_METER_NAME		"power_meter"
 ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
 #define ACPI_POWER_METER_DEVICE_NAME	"Power Meter"
-#define ACPI_POWER_METER_CLASS		"power_meter_resource"
+#define ACPI_POWER_METER_CLASS		"pwr_meter_resource"
 
 #define NUM_SENSORS			17
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] power_meter: acpi_device_class "power_meter_resource" too long
  2010-03-19 11:49 [patch] power_meter: acpi_device_class "power_meter_resource" too long Dan Carpenter
@ 2010-03-22 18:13 ` Darrick J. Wong
  2010-03-23 16:26 ` Thomas Renninger
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2010-03-22 18:13 UTC (permalink / raw
  To: Dan Carpenter, Len Brown, Andrew Morton, Márton Németh

On Fri, Mar 19, 2010 at 02:49:20PM +0300, Dan Carpenter wrote:
> acpi_device_class can only be 19 characters and a NULL terminator.
> 
> The current code has a buffer overflow in acpi_power_meter_add():
>        strcpy(acpi_device_class(device), ACPI_POWER_METER_CLASS);
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> Feel free to change the name to anything you like.

How hard would it be to increase the size of that buffer?

(Or, is there a need to have "_resource" in that string at all?)

--D

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] power_meter: acpi_device_class "power_meter_resource" too long
  2010-03-19 11:49 [patch] power_meter: acpi_device_class "power_meter_resource" too long Dan Carpenter
  2010-03-22 18:13 ` Darrick J. Wong
@ 2010-03-23 16:26 ` Thomas Renninger
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Renninger @ 2010-03-23 16:26 UTC (permalink / raw
  To: Dan Carpenter
  Cc: Len Brown, Darrick J. Wong, Andrew Morton,
	Márton Németh, Lin Ming, linux-acpi, linux-kernel,
	kernel-janitors

On Friday 19 March 2010 12:49:20 Dan Carpenter wrote:
> acpi_device_class can only be 19 characters and a NULL terminator.
> 
> The current code has a buffer overflow in acpi_power_meter_add():
>        strcpy(acpi_device_class(device), ACPI_POWER_METER_CLASS);
Sounds as if it would be worth to add:
CC: stable@kernel.org
?
Same for processor_aggregator.

     Thomas
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> Feel free to change the name to anything you like.
> 
> diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c
> index 834c5af..31baa1e 100644
> --- a/drivers/acpi/power_meter.c
> +++ b/drivers/acpi/power_meter.c
> @@ -34,7 +34,7 @@
>  #define ACPI_POWER_METER_NAME		"power_meter"
>  ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
>  #define ACPI_POWER_METER_DEVICE_NAME	"Power Meter"
> -#define ACPI_POWER_METER_CLASS		"power_meter_resource"
> +#define ACPI_POWER_METER_CLASS		"pwr_meter_resource"
>  
>  #define NUM_SENSORS			17
>  
> --

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-23 16:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-19 11:49 [patch] power_meter: acpi_device_class "power_meter_resource" too long Dan Carpenter
2010-03-22 18:13 ` Darrick J. Wong
2010-03-23 16:26 ` Thomas Renninger

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 read-only IMAP folder(s) and NNTP newsgroup(s).