skip copy_to_user() when r->ret is negative error number in mckernel_procfs_read().

refs #370
This commit is contained in:
Susumu Komae
2015-01-08 12:38:06 +09:00
committed by postpeta
parent e3eb7e68bc
commit 74f0aec478

View File

@ -380,6 +380,7 @@ retry:
goto retry; goto retry;
} }
if (r->ret > 0) {
if (copy_to_user(buf, kern_buffer, r->ret)) { if (copy_to_user(buf, kern_buffer, r->ret)) {
kprintf("ERROR: mckernel_procfs_read: copy_to_user failed.\n"); kprintf("ERROR: mckernel_procfs_read: copy_to_user failed.\n");
ret = -EFAULT; ret = -EFAULT;
@ -387,6 +388,7 @@ retry:
} }
*ppos += r->ret; *ppos += r->ret;
}
ret = r->ret; ret = r->ret;
out: out: