Skip to contentSkip to conversation

iov_iter: fix return type of __pipe_get_pages()

PATCH Applied Ilya Dryomov 2 participants 3 messages May 2, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 iov_iter: fix return type of __pipe_get_pages()

It returns -EFAULT and happens to be a helper for pipe_get_pages() whose return type is ssize_t.

---
 lib/iov_iter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/iov_iter.c +1 -1
index 970212670b6a..4d5bf40d399d 100644
@@ -1012,7 +1012,7 @@ unsigned long iov_iter_gap_alignment(const struct iov_iter *i)
 }
 EXPORT_SYMBOL(iov_iter_gap_alignment);
 
-static inline size_t __pipe_get_pages(struct iov_iter *i,
+static inline ssize_t __pipe_get_pages(struct iov_iter *i,
 				size_t maxsize,
 				struct page **pages,
 				int idx,
Signature · 1 line
2.4.3
#1 lore raw

PATCH 2/2 iov_iter: fix memory leak in pipe_get_pages_alloc()

Make n signed to avoid leaking the pages array if __pipe_get_pages() fails.

---
 lib/iov_iter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/iov_iter.c +1 -1
index 4d5bf40d399d..fdae394172fa 100644
@@ -1102,7 +1102,7 @@ static ssize_t pipe_get_pages_alloc(struct iov_iter *i,
 		   size_t *start)
 {
 	struct page **p;
-	size_t n;
+	ssize_t n;
 	int idx;
 	int npages;
 
Signature · 1 line
2.4.3
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] iov_iter: fix memory leak in pipe_get_pages_alloc()

Quoted 2 lines · Ilya Dryomov

Make n signed to avoid leaking the pages array if __pipe_get_pages() fails.

Applied, with s/fails/& to allocate any pages/.