Skip to content

Commit

Permalink
/dev/zero: avoid repeated access_ok() checks
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Nikanth Karthikesan authored and torvalds committed Sep 24, 2009
1 parent 0b8c78f commit bb521c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bb521c5

Please sign in to comment.