We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fed2ef7 commit 9cca73dCopy full SHA for 9cca73d
drivers/hwmon/acpi_power_meter.c
@@ -796,14 +796,13 @@ static int read_capabilities(struct acpi_power_meter_resource *resource)
796
goto error;
797
}
798
799
- *str = kcalloc(element->string.length + 1, sizeof(u8),
800
- GFP_KERNEL);
+ *str = kmemdup_nul(element->string.pointer, element->string.length,
+ GFP_KERNEL);
801
if (!*str) {
802
res = -ENOMEM;
803
804
805
806
- strncpy(*str, element->string.pointer, element->string.length);
807
str++;
808
809
0 commit comments