* [PATCH] ACPI: use kstrto*() instead of simple_strto*()
@ 2014-06-13 19:49 Christoph Jaeger
2014-06-17 0:24 ` David Rientjes
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Jaeger @ 2014-06-13 19:49 UTC (permalink / raw)
To: rjw, lenb; +Cc: linux-acpi, linux-kernel, Christoph Jaeger
simple_strto*() are obsolete; use kstrto*() instead. Add proper error
checking.
Signed-off-by: Christoph Jaeger <christophjaeger@linux.com>
---
drivers/acpi/battery.c | 5 ++++-
drivers/acpi/osl.c | 3 ++-
drivers/acpi/tables.c | 3 ++-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index e48fc98..5963e6f 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -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)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 3f2bdc8..bad25b0 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -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);
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 05550ba..6d5a6cd 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -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);
--
1.9.3
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ACPI: use kstrto*() instead of simple_strto*()
2014-06-13 19:49 [PATCH] ACPI: use kstrto*() instead of simple_strto*() Christoph Jaeger
@ 2014-06-17 0:24 ` David Rientjes
2014-06-19 0:04 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: David Rientjes @ 2014-06-17 0:24 UTC (permalink / raw)
To: Christoph Jaeger; +Cc: rjw, lenb, linux-acpi, linux-kernel
On Fri, 13 Jun 2014, Christoph Jaeger wrote:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ACPI: use kstrto*() instead of simple_strto*()
2014-06-17 0:24 ` David Rientjes
@ 2014-06-19 0:04 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2014-06-19 0:04 UTC (permalink / raw)
To: David Rientjes; +Cc: Christoph Jaeger, lenb, linux-acpi, linux-kernel
On Monday, June 16, 2014 05:24:12 PM David Rientjes wrote:
> On Fri, 13 Jun 2014, Christoph Jaeger wrote:
>
> > 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>
Applied, thanks!
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-18 23:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13 19:49 [PATCH] ACPI: use kstrto*() instead of simple_strto*() Christoph Jaeger
2014-06-17 0:24 ` David Rientjes
2014-06-19 0:04 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®