VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / parisc / led.c
index 7d49780..c7d2d5d 100644 (file)
@@ -157,13 +157,13 @@ static int led_proc_read(char *page, char **start, off_t off, int count,
 static int led_proc_write(struct file *file, const char *buf, 
        unsigned long count, void *data)
 {
-       char *cur, lbuf[count];
+       char *cur, lbuf[count + 1];
        int d;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EACCES;
 
-       memset(lbuf, 0, count);
+       memset(lbuf, 0, count + 1);
 
        if (copy_from_user(lbuf, buf, count))
                return -EFAULT;
@@ -197,7 +197,7 @@ static int led_proc_write(struct file *file, const char *buf,
 
                break;
        case LED_HASLCD:
-               while (*cur && cur[strlen(cur)-1] == '\n')
+               if (*cur && cur[strlen(cur)-1] == '\n')
                        cur[strlen(cur)-1] = 0;
                if (*cur == 0) 
                        cur = lcd_text_default;