Skip to contentSkip to conversation

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

PATCH In review Harvey Harrison 1 participant 1 message Mar 14, 2008 FUSE filesystem core

lore
Share & tools
lore
#0 lore raw

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

clamp() exists for this use.

---
 fs/fuse/file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/fuse/file.c +1 -1
index 676b0bc..8c6d51d 100644
@@ -613,7 +613,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);
Signature · 1 line
1.5.4.4.653.g7cf1e