linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watch_queue: Fix wrong return value of watch_queue_set_size()
@ 2020-11-12 14:03 Zhang Xiaoxu
  0 siblings, 0 replies; only message in thread
From: Zhang Xiaoxu @ 2020-11-12 14:03 UTC (permalink / raw)
  To: zhangxiaoxu5, dhowells, jarkko, linux-kernel

If memory allocate failed, we should return -ENOMEM rather than 0.

Fixes: c73be61cede5 ("pipe: Add general notification queue support")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
---
 kernel/watch_queue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index 0ef8f65bd2d7..3084060a52d2 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -247,6 +247,7 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
 	if (ret < 0)
 		goto error;
 
+	ret = -ENOMEM;
 	pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
 	if (!pages)
 		goto error;
-- 
2.25.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-12 14:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 14:03 [PATCH] watch_queue: Fix wrong return value of watch_queue_set_size() Zhang Xiaoxu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).