[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1669882045-41842-1-git-send-email-wangyufen@huawei.com>
Date: Thu, 1 Dec 2022 16:07:25 +0800
From: Wang Yufen <wangyufen@...wei.com>
To: <dhowells@...hat.com>, <christophe.jaillet@...adoo.fr>
CC: <linux-kernel@...r.kernel.org>, Wang Yufen <wangyufen@...wei.com>
Subject: [PATCH] watch_queue: Fix error return code in watch_queue_set_size()
Fix to return a negative error code -ENOMEM instead of 0.
Fixes: c73be61cede5 ("pipe: Add general notification queue support")
Signed-off-by: Wang Yufen <wangyufen@...wei.com>
---
kernel/watch_queue.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index a6f9bdd..fe6e19c 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -274,19 +274,25 @@ long watch_queue_set_size(struct pipe_inode_info *pipe, unsigned int nr_notes)
goto error;
pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
- if (!pages)
+ if (!pages) {
+ ret = -ENOMEM;
goto error;
+ }
for (i = 0; i < nr_pages; i++) {
pages[i] = alloc_page(GFP_KERNEL);
- if (!pages[i])
+ if (!pages[i]) {
+ ret = -ENOMEM;
goto error_p;
+ }
pages[i]->index = i * WATCH_QUEUE_NOTES_PER_PAGE;
}
bitmap = bitmap_alloc(nr_notes, GFP_KERNEL);
- if (!bitmap)
+ if (!bitmap) {
+ ret = -ENOMEM;
goto error_p;
+ }
bitmap_fill(bitmap, nr_notes);
wqueue->notes = pages;
--
1.8.3.1
Powered by blists - more mailing lists