summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/mem.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index fba76fb55abf..f0a90590cb1a 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -581,14 +581,12 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
if (len > PAGE_SIZE)
len = PAGE_SIZE;
- if (len) {
- written = copy_from_user(kbuf, buf, len);
- if (written) {
- if (wrote + virtr)
- break;
- free_page((unsigned long)kbuf);
- return -EFAULT;
- }
+ written = copy_from_user(kbuf, buf, len);
+ if (written) {
+ if (wrote + virtr)
+ break;
+ free_page((unsigned long)kbuf);
+ return -EFAULT;
}
len = vwrite(kbuf, (char *)p, len);
count -= len;
OpenPOWER on IntegriCloud