提交 975c3025 编写于 作者: S Signed-off by Yi Yang 提交者: Len Brown

ACPI: detect invalid argument written to /proc/acpi/alarm

/proc/acpi/alarm can't be set correctly, here is a sample:

[root@localhost /]# echo "2006 09" > /proc/acpi/alarm
[root@localhost /]# cat /proc/acpi/alarm
2007-12-09 09:09:09
[root@localhost /]# echo "2006 04" > /proc/acpi/alarm
[root@localhost /]# cat /proc/acpi/alarm
2007-12-04 04:04:04
[root@localhost /]#

Obviously, it is wrong, it should consider it as an invalid input.

after this patch:

[root@localhost /]# echo "2008 09" > /proc/acpi/alarm
-bash: echo: write error: Invalid argument
[root@localhost /]#
Signed-off-by: NYi Yang <yi.y.yang@intel.com>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 c68cb23d
......@@ -178,6 +178,9 @@ static int get_date_field(char **p, u32 * value)
* Try to find delimeter, only to insert null. The end of the
* string won't have one, but is still valid.
*/
if (*p == NULL)
return result;
next = strpbrk(*p, "- :");
if (next)
*next++ = '\0';
......@@ -190,6 +193,8 @@ static int get_date_field(char **p, u32 * value)
if (next)
*p = next;
else
*p = NULL;
return result;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册