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

Commit bd730967 authored by Harvey Harrison's avatar Harvey Harrison Committed by Linus Torvalds
Browse files

fuse: use clamp() rather than nested min/max



clamp() exists for this use.

Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3dfcf9c4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -934,7 +934,7 @@ static int fuse_get_user_pages(struct fuse_req *req, const char __user *buf,

	nbytes = min(nbytes, (unsigned) FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT);
	npages = (nbytes + offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
	npages = min(max(npages, 1), FUSE_MAX_PAGES_PER_REQ);
	npages = clamp(npages, 1, FUSE_MAX_PAGES_PER_REQ);
	down_read(&current->mm->mmap_sem);
	npages = get_user_pages(current, current->mm, user_addr, npages, write,
				0, req->pages, NULL);