mm/vmalloc: replace the ternary conditional operator with min()
authorLu Hongfei <luhongfei@vivo.com>
Fri, 9 Jun 2023 09:30:57 +0000 (17:30 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 19 Jun 2023 23:19:11 +0000 (16:19 -0700)
It would be better to replace the traditional ternary conditional
operator with min() in zero_iter

Link: https://lkml.kernel.org/r/20230609093057.27777-1-luhongfei@vivo.com
Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vmalloc.c

index 9d64a40..d07d014 100644 (file)
@@ -3562,7 +3562,7 @@ static size_t zero_iter(struct iov_iter *iter, size_t count)
        while (remains > 0) {
                size_t num, copied;
 
-               num = remains < PAGE_SIZE ? remains : PAGE_SIZE;
+               num = min_t(size_t, remains, PAGE_SIZE);
                copied = copy_page_to_iter_nofault(ZERO_PAGE(0), 0, num, iter);
                remains -= copied;