[PATCH] /dev/zero: Avoid repeated access_ok() checks
From: Nikanth Karthikesan
Date: Tue Jul 07 2009 - 01:27:50 EST
In read_zero, we check for access_ok() once for the count bytes. It is
unnecessarily checked again in clear_user. Use __clear_user, which does not
check for access_ok().
Signed-off-by: Nikanth Karthikesan <knikanth@xxxxxxx>
---
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index afa8813..3e05b48 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -690,7 +690,7 @@ static ssize_t read_zero(struct file * file, char __user * buf,
if (chunk > PAGE_SIZE)
chunk = PAGE_SIZE; /* Just for latency reasons */
- unwritten = clear_user(buf, chunk);
+ unwritten = __clear_user(buf, chunk);
written += chunk - unwritten;
if (unwritten)
break;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/