[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <771479.1579519948@warthog.procyon.org.uk>
Date: Mon, 20 Jan 2020 11:32:28 +0000
From: David Howells <dhowells@...hat.com>
To: Wei Yongjun <weiyongjun1@...wei.com>
Cc: dhowells@...hat.com, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH -next] watch_queue: Fix error return code in watch_queue_set_size()
Wei Yongjun <weiyongjun1@...wei.com> wrote:
> pages = kcalloc(sizeof(struct page *), nr_pages, GFP_KERNEL);
> - if (!pages)
> + if (!pages) {
> + ret = -ENOMEM;
I think the preferred method would be to set ret before calling kcalloc as the
attached.
David
---
diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index 8c625cf451e6..a11724d66834 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -249,6 +249,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;
Powered by blists - more mailing lists