rt2x00: fix "buffer size not provably correct" build warning

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>
This commit is contained in:
Arnaud Patard (Rtp) 2010-08-23 23:02:22 +02:00 committed by John W. Linville
parent 8d1331b37d
commit f8d8b7a13d
1 changed files with 3 additions and 0 deletions

View 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; \
\