]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fs-proc-vmcorec-put-if-tests-in-the-top-of-the-while-loop-to-reduce-duplication-fix
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 20 Feb 2013 02:15:57 +0000 (13:15 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Feb 2013 05:53:34 +0000 (16:53 +1100)
avoid `if (foo = bar)' thing, use min_t()

Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/proc/vmcore.c

index b92b289010ba46cc051d313a5f3778cfd9882b3f..6e2bcf4c051ff7f3a5e8956b73571cb27c02026b 100644 (file)
@@ -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));