i2o: fix overflow of copy_to_user()

If (len > reslen) we must not call copy_to_user() since kernel buffer is
smaller than we want to copy.  Similar code in this file is correct, so
this bug was a typo.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Kulikov Vasiliy 2010-08-10 18:02:03 -07:00 коммит произвёл Linus Torvalds
Родитель 32fa45498f
Коммит d929dc2bfd
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -115,7 +115,7 @@ static int i2o_cfg_gethrt(unsigned long arg)
put_user(len, kcmd.reslen);
if (len > reslen)
ret = -ENOBUFS;
if (copy_to_user(kcmd.resbuf, (void *)hrt, len))
else if (copy_to_user(kcmd.resbuf, (void *)hrt, len))
ret = -EFAULT;
return ret;