Skip to contentSkip to conversation

power_meter: acpi_device_class "power_meter_resource" too long

PATCH In review Dan Carpenter 3 participants 3 messages Mar 19, 2010 – Mar 23, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power_meter: acpi_device_class "power_meter_resource" too long

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);

---
Feel free to change the name to anything you like.

drivers/acpi/power_meter.c +1 -1
index 834c5af..31baa1e 100644
@@ -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
 
#1 lore raw
Quoted 8 lines · Dan Carpenter

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);

---
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

#2 lore raw
In reply to Dan Carpenter
Quoted 4 lines · 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: [email protected]
?
Same for processor_aggregator.

Thomas

Quoted 19 lines

---
Feel free to change the name to anything you like.

drivers/acpi/power_meter.c +1 -2
index 834c5af..31baa1e 100644
@@ -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
 
--