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,13 +380,15 @@ retry:
goto retry;
}
if (copy_to_user(buf, kern_buffer, r->ret)) {
kprintf("ERROR: mckernel_procfs_read: copy_to_user failed.\n");
ret = -EFAULT;
goto out;
}
if (r->ret > 0) {
if (copy_to_user(buf, kern_buffer, r->ret)) {
kprintf("ERROR: mckernel_procfs_read: copy_to_user failed.\n");
ret = -EFAULT;
goto out;
}
*ppos += r->ret;
*ppos += r->ret;
}
ret = r->ret;
out: