Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: use kstrto*() instead of simple_strto*()

simple_strto*() are obsolete; use kstrto*() instead. Add proper error
checking.

Signed-off-by: Christoph Jaeger <christophjaeger@linux.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Christoph Jaeger and committed by
Rafael J. Wysocki
3d915894 7171511e

+8 -3
+4 -1
drivers/acpi/battery.c
··· 930 930 goto end; 931 931 } 932 932 alarm_string[count] = '\0'; 933 - battery->alarm = simple_strtol(alarm_string, NULL, 0); 933 + if (kstrtoint(alarm_string, 0, &battery->alarm)) { 934 + result = -EINVAL; 935 + goto end; 936 + } 934 937 result = acpi_battery_set_alarm(battery); 935 938 end: 936 939 if (!result)
+2 -1
drivers/acpi/osl.c
··· 235 235 static unsigned long acpi_rsdp; 236 236 static int __init setup_acpi_rsdp(char *arg) 237 237 { 238 - acpi_rsdp = simple_strtoul(arg, NULL, 16); 238 + if (kstrtoul(arg, 16, &acpi_rsdp)) 239 + return -EINVAL; 239 240 return 0; 240 241 } 241 242 early_param("acpi_rsdp", setup_acpi_rsdp);
+2 -1
drivers/acpi/tables.c
··· 360 360 if (!str) 361 361 return -EINVAL; 362 362 363 - acpi_apic_instance = simple_strtoul(str, NULL, 0); 363 + if (kstrtoint(str, 0, &acpi_apic_instance)) 364 + return -EINVAL; 364 365 365 366 pr_notice("Shall use APIC/MADT table %d\n", acpi_apic_instance); 366 367