rt2x00: fix "buffer size not provably correct" build warning
authorArnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
Mon, 23 Aug 2010 21:02:22 +0000 (23:02 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 25 Aug 2010 18:34:56 +0000 (14:34 -0400)
rt2x00 debugfs interface doesn't check the size of the data coming
from userspace, leading to a build warning. Fix That.

v2: return EINVAL if input is too long

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2x00debug.c

index 74f0d67..daf7f95 100644 (file)
@@ -480,6 +480,9 @@ static ssize_t rt2x00debug_write_##__name(struct file *file,        \
        if (index >= debug->__name.word_count)                  \
                return -EINVAL;                                 \
                                                                \
+       if (length > sizeof(line))                              \
+               return -EINVAL;                                 \
+                                                               \
        if (copy_from_user(line, buf, length))                  \
                return -EFAULT;                                 \
                                                                \