From: Harvey Harrison Date: Thu, 1 May 2008 11:35:15 +0000 (-0700) Subject: fuse: use clamp() rather than nested min/max X-Git-Tag: firefly_0821_release~20524 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bd7309677c937bf23296f6c81027123c84c5cc5c;p=firefly-linux-kernel-4.4.55.git fuse: use clamp() rather than nested min/max clamp() exists for this use. Signed-off-by: Harvey Harrison Cc: Miklos Szeredi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 9ced35b00686..f28cf8b46f80 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -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(¤t->mm->mmap_sem); npages = get_user_pages(current, current->mm, user_addr, npages, write, 0, req->pages, NULL);