[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1198738022.8950.3.camel@yangyi-dev.bj.intel.com>
Date: Thu, 27 Dec 2007 14:47:02 +0800
From: Yi Yang <yi.y.yang@...el.com>
To: linux-acpi@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, lenb@...nel.org,
acpi-bugzilla@...ts.sourceforge.net
Subject: [PATCH linux-acpi] Fix /proc/acpi/alarm set error
/proc/acpi/alarm can't be set correctly, here is a sample:
[root@...alhost /]# echo "2006 09" > /proc/acpi/alarm
[root@...alhost /]# cat /proc/acpi/alarm
2007-12-09 09:09:09
[root@...alhost /]# echo "2006 04" > /proc/acpi/alarm
[root@...alhost /]# cat /proc/acpi/alarm
2007-12-04 04:04:04
[root@...alhost /]#
Obviously, it is wrong, it should consider it as an invalid input.
This patch'll fix this issue, after applying this patch, the result is:
[root@...alhost /]# echo "2008 09" > /proc/acpi/alarm
-bash: echo: write error: Invalid argument
[root@...alhost /]#
Signed-off by Yi Yang <yi.y.yang@...el.com>
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index 1538355..fce78fb 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -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;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists