From 207ba9c4e304e7527012711ddbf64c019d9fc87c Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 20 Feb 2013 13:15:57 +1100 Subject: [PATCH] fs-proc-vmcorec-put-if-tests-in-the-top-of-the-while-loop-to-reduce-duplication-fix avoid `if (foo = bar)' thing, use min_t() Cc: Zhang Yanfei Cc: "Eric W. Biederman" Signed-off-by: Andrew Morton --- fs/proc/vmcore.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index b92b289010ba..6e2bcf4c051f 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -178,8 +178,7 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer, return -EINVAL; while (buflen) { - if ((tsz = (PAGE_SIZE - (start & ~PAGE_MASK))) > buflen) - tsz = buflen; + tsz = max_t(size_t, buflen, PAGE_SIZE - (start & ~PAGE_MASK)); /* Calculate left bytes in current memory segment. */ nr_bytes = (curr_m->size - (start - curr_m->paddr)); -- 2.39.5