* [PATCH] /dev/zero: Avoid repeated access_ok() checks
@ 2009-07-07 5:29 Nikanth Karthikesan
0 siblings, 0 replies; only message in thread
From: Nikanth Karthikesan @ 2009-07-07 5:29 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
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@suse.de>
---
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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2009-07-07 5:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-07 5:29 [PATCH] /dev/zero: Avoid repeated access_ok() checks Nikanth Karthikesan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox