Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=975c30257e75c3d067d4858f60963b80fc6bd0e4
Commit:     975c30257e75c3d067d4858f60963b80fc6bd0e4
Parent:     c68cb23dde29fb107575656effa46f7b9440ac04
Author:     Signed-off by Yi Yang <[EMAIL PROTECTED]>
AuthorDate: Thu Dec 27 21:50:42 2007 -0500
Committer:  Len Brown <[EMAIL PROTECTED]>
CommitDate: Thu Dec 27 22:19:27 2007 -0500

    ACPI: detect invalid argument written to /proc/acpi/alarm
    
    /proc/acpi/alarm can't be set correctly, here is a sample:
    
    [EMAIL PROTECTED] /]# echo "2006 09" > /proc/acpi/alarm
    [EMAIL PROTECTED] /]# cat /proc/acpi/alarm
    2007-12-09 09:09:09
    [EMAIL PROTECTED] /]# echo "2006 04" > /proc/acpi/alarm
    [EMAIL PROTECTED] /]# cat /proc/acpi/alarm
    2007-12-04 04:04:04
    [EMAIL PROTECTED] /]#
    
    Obviously, it is wrong, it should consider it as an invalid input.
    
    after this patch:
    
    [EMAIL PROTECTED] /]# echo "2008 09" > /proc/acpi/alarm
    -bash: echo: write error: Invalid argument
    [EMAIL PROTECTED] /]#
    
    Signed-off-by: Yi Yang <[EMAIL PROTECTED]>
    Signed-off-by: Len Brown <[EMAIL PROTECTED]>
---
 drivers/acpi/sleep/proc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

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 git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to