提交 f8d8b7a1 编写于 作者: A Arnaud Patard (Rtp) 提交者: John W. Linville

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: NArnaud Patard <arnaud.patard@rtp-net.org>
Acked-by: NIvo van Doorn <IvDoorn@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 8d1331b3
...@@ -480,6 +480,9 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \ ...@@ -480,6 +480,9 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \
if (index >= debug->__name.word_count) \ if (index >= debug->__name.word_count) \
return -EINVAL; \ return -EINVAL; \
\ \
if (length > sizeof(line)) \
return -EINVAL; \
\
if (copy_from_user(line, buf, length)) \ if (copy_from_user(line, buf, length)) \
return -EFAULT; \ return -EFAULT; \
\ \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册