Home
last modified time | relevance | path

Searched hist:c48b1565 (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/drivers/acpi/
H A Dsysfs.cc48b1565 Thu Sep 12 02:32:05 CDT 2013 Lan Tianyu <tianyu.lan@intel.com> ACPI / sysfs: make GPE sysfs attributes only accept correct values

According to the design, GPE sysfs attributes should accept "disable",
"enable", "clear" and integer numbers as params. Current code checks
"disable", "enable" and "clear" first. If the param doesn't match,
pass it to strtoul() as a string representing an integer number and
assign the return value to the given GPE count. It is missing the check
of whether or not the param really represents an integer number and
strtoul() will return 0 if the string is not a number. This causes any
params except for "enable", "disable", "clear" and a number to make the
GPE count become 0. This patch is to use kstrtoul() to replace strtoul()
and check the return value. If the convertion is successful, use as the
new GPE count. If not, return an error.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
c48b1565 Thu Sep 12 02:32:05 CDT 2013 Lan Tianyu <tianyu.lan@intel.com> ACPI / sysfs: make GPE sysfs attributes only accept correct values

According to the design, GPE sysfs attributes should accept "disable",
"enable", "clear" and integer numbers as params. Current code checks
"disable", "enable" and "clear" first. If the param doesn't match,
pass it to strtoul() as a string representing an integer number and
assign the return value to the given GPE count. It is missing the check
of whether or not the param really represents an integer number and
strtoul() will return 0 if the string is not a number. This causes any
params except for "enable", "disable", "clear" and a number to make the
GPE count become 0. This patch is to use kstrtoul() to replace strtoul()
and check the return value. If the convertion is successful, use as the
new GPE count. If not, return an error.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>