power_meter: acpi_device_class "power_meter_resource" too long
Subsystems (2)
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
@@ -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
Quoted 8 lines · Dan Carpenter
acpi_device_classcan 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 <[email protected]>---
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
Quoted 4 lines · On Friday 19 March 2010 12:49:20 Dan Carpenter wrote:
acpi_device_classcan 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
Signed-off-by Dan Carpenter <[email protected]>---
Feel free to change the name to anything you like.drivers/acpi/power_meter.c +1
-2@@ -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 --