ACPI: use kstrto*() instead of simple_strto*()
authorChristoph Jaeger <christophjaeger@linux.com>
Fri, 13 Jun 2014 19:49:58 +0000 (21:49 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 17 Jun 2014 12:01:56 +0000 (14:01 +0200)
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>
drivers/acpi/battery.c
drivers/acpi/osl.c
drivers/acpi/tables.c

index e48fc98e71c48379694bbbd76119dd1c222660ac..5963e6f0a1ed1cbae53f3852e7129173ad421bf6 100644 (file)
@@ -930,7 +930,10 @@ static ssize_t acpi_battery_write_alarm(struct file *file,
                goto end;
        }
        alarm_string[count] = '\0';
-       battery->alarm = simple_strtol(alarm_string, NULL, 0);
+       if (kstrtoint(alarm_string, 0, &battery->alarm)) {
+               result = -EINVAL;
+               goto end;
+       }
        result = acpi_battery_set_alarm(battery);
       end:
        if (!result)
index 3f2bdc812d23b7c2b4175448793eb56c96af2b47..bad25b070fe0bfe8b0204cce2ddd5ce30f07ec91 100644 (file)
@@ -235,7 +235,8 @@ void acpi_os_vprintf(const char *fmt, va_list args)
 static unsigned long acpi_rsdp;
 static int __init setup_acpi_rsdp(char *arg)
 {
-       acpi_rsdp = simple_strtoul(arg, NULL, 16);
+       if (kstrtoul(arg, 16, &acpi_rsdp))
+               return -EINVAL;
        return 0;
 }
 early_param("acpi_rsdp", setup_acpi_rsdp);
index 05550ba44d32ba59dba6cea489dc622965cc9692..6d5a6cda0734de6a46a577a71225dd43163acc69 100644 (file)
@@ -360,7 +360,8 @@ static int __init acpi_parse_apic_instance(char *str)
        if (!str)
                return -EINVAL;
 
-       acpi_apic_instance = simple_strtoul(str, NULL, 0);
+       if (kstrtoint(str, 0, &acpi_apic_instance))
+               return -EINVAL;
 
        pr_notice("Shall use APIC/MADT table %d\n", acpi_apic_instance);