All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iomap: turn the byte variable in iomap_zero_iter into a ssize_t
@ 2021-12-08  9:12 Christoph Hellwig
  2021-12-09  0:48 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Christoph Hellwig @ 2021-12-08  9:12 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-fsdevel, linux-xfs, nvdimm, Dan Carpenter

bytes also hold the return value from iomap_write_end, which can contain
a negative error value.  As bytes is always less than the page size even
the signed type can hold the entire possible range.

Fixes: c6f40468657d ("fsdax: decouple zeroing from the iomap buffered I/O code")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/iomap/buffered-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index b1511255b4df8..ac040d607f4fe 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -883,7 +883,7 @@ static loff_t iomap_zero_iter(struct iomap_iter *iter, bool *did_zero)
 
 	do {
 		unsigned offset = offset_in_page(pos);
-		size_t bytes = min_t(u64, PAGE_SIZE - offset, length);
+		ssize_t bytes = min_t(u64, PAGE_SIZE - offset, length);
 		struct page *page;
 		int status;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-12-21  4:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08  9:12 [PATCH] iomap: turn the byte variable in iomap_zero_iter into a ssize_t Christoph Hellwig
2021-12-09  0:48 ` Darrick J. Wong
2021-12-09  0:55   ` Darrick J. Wong
2021-12-09  1:58     ` Dan Williams
2021-12-09  6:11     ` Christoph Hellwig
2021-12-09 18:19       ` Darrick J. Wong
2021-12-11 17:50 ` Matthew Wilcox
2021-12-13  7:38   ` Christoph Hellwig
2021-12-20 22:10 ` Matthew Wilcox
2021-12-21  4:12   ` Dan Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.