aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char
diff options
context:
space:
mode:
authorDavi Arnaut <davi.arnaut@gmail.com>2006-02-01 06:06:40 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-01 11:53:25 -0500
commit172411f10c25bbd81b19f67566af6a7f549f46a9 (patch)
tree1a4bf56e53fdc6ea51cc2a72957e0eee710a284f /drivers/s390/char
parent46d0d2c811c8e9dd5cffdc3a5c03d988eb5a2996 (diff)
[PATCH] ebcdic do_kdsk_ioctl off-by-one
Add a missing return check from strnlen_user and fixes a off-by-one when terminating the string with zero. Signed-off-by: Davi Arnaut <davi.arnaut@gmail.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/char')
-rw-r--r--drivers/s390/char/keyboard.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c
index 5bda2340a39d..a317a123daba 100644
--- a/drivers/s390/char/keyboard.c
+++ b/drivers/s390/char/keyboard.c
@@ -440,7 +440,11 @@ do_kdgkb_ioctl(struct kbd_data *kbd, struct kbsentry __user *u_kbs,
440 return -EPERM; 440 return -EPERM;
441 len = strnlen_user(u_kbs->kb_string, 441 len = strnlen_user(u_kbs->kb_string,
442 sizeof(u_kbs->kb_string) - 1); 442 sizeof(u_kbs->kb_string) - 1);
443 p = kmalloc(len, GFP_KERNEL); 443 if (!len)
444 return -EFAULT;
445 if (len > sizeof(u_kbs->kb_string) - 1)
446 return -EINVAL;
447 p = kmalloc(len + 1, GFP_KERNEL);
444 if (!p) 448 if (!p)
445 return -ENOMEM; 449 return -ENOMEM;
446 if (copy_from_user(p, u_kbs->kb_string, len)) { 450 if (copy_from_user(p, u_kbs->kb_string, len)) {