Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb521c5d authored by Nikanth Karthikesan's avatar Nikanth Karthikesan Committed by Linus Torvalds
Browse files

/dev/zero: avoid repeated access_ok() checks



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: default avatarNikanth Karthikesan <knikanth@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0b8c78f2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;