Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cifs: Use min_t() when comparing "size_t" and "unsigned long"

On 32 bit, size_t is "unsigned int", not "unsigned long", causing the
following warning when comparing with PAGE_SIZE, which is always "unsigned
long":

fs/cifs/file.c: In function ‘cifs_readdata_to_iov’:
fs/cifs/file.c:2757: warning: comparison of distinct pointer types lacks a cast

Introduced by commit 7f25bba819a3 ("cifs_iovec_read: keep iov_iter
between the calls of cifs_readdata_to_iov()"), which changed the
signedness of "remaining" and the code from min_t() to min().

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Geert Uytterhoeven and committed by
Linus Torvalds
e686bd8d bf3a3407

+1 -1
+1 -1
fs/cifs/file.c
··· 2754 2754 2755 2755 for (i = 0; i < rdata->nr_pages; i++) { 2756 2756 struct page *page = rdata->pages[i]; 2757 - size_t copy = min(remaining, PAGE_SIZE); 2757 + size_t copy = min_t(size_t, remaining, PAGE_SIZE); 2758 2758 size_t written = copy_page_to_iter(page, 0, copy, iter); 2759 2759 remaining -= written; 2760 2760 if (written < copy && iov_iter_count(iter) > 0)