From: Wei Yongjun <weiyongjun1@huawei.com> To: David Howells <dhowells@redhat.com> Cc: Wei Yongjun <weiyongjun1@huawei.com>, <linux-kernel@vger.kernel.org>, <kernel-janitors@vger.kernel.org> Subject: [PATCH -next] watch_queue: Fix error return code in watch_queue_set_size() Date: Mon, 20 Jan 2020 08:54:11 +0000 [thread overview] Message-ID: <20200120085411.116252-1-weiyongjun1@huawei.com> (raw) Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: d9a34f010efd ("pipe: Add general notification queue support") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.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 f195cbbbb3d3..3051cf4e35c6 100644 --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -252,21 +252,27 @@ 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; } bmsize = (nr_notes + BITS_PER_LONG - 1) / BITS_PER_LONG; bmsize *= sizeof(unsigned long); bitmap = kmalloc(bmsize, GFP_KERNEL); - if (!bitmap) + if (!bitmap) { + ret = -ENOMEM; goto error_p; + } memset(bitmap, 0xff, bmsize); wqueue->notes = pages;
WARNING: multiple messages have this Message-ID (diff)
From: Wei Yongjun <weiyongjun1@huawei.com> To: David Howells <dhowells@redhat.com> Cc: Wei Yongjun <weiyongjun1@huawei.com>, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH -next] watch_queue: Fix error return code in watch_queue_set_size() Date: Mon, 20 Jan 2020 08:54:11 +0000 [thread overview] Message-ID: <20200120085411.116252-1-weiyongjun1@huawei.com> (raw) Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: d9a34f010efd ("pipe: Add general notification queue support") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.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 f195cbbbb3d3..3051cf4e35c6 100644 --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -252,21 +252,27 @@ 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; } bmsize = (nr_notes + BITS_PER_LONG - 1) / BITS_PER_LONG; bmsize *= sizeof(unsigned long); bitmap = kmalloc(bmsize, GFP_KERNEL); - if (!bitmap) + if (!bitmap) { + ret = -ENOMEM; goto error_p; + } memset(bitmap, 0xff, bmsize); wqueue->notes = pages;
next reply other threads:[~2020-01-20 8:59 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-20 8:54 Wei Yongjun [this message] 2020-01-20 8:54 ` [PATCH -next] watch_queue: Fix error return code in watch_queue_set_size() Wei Yongjun 2020-01-20 11:32 ` David Howells 2020-01-22 7:48 ` [PATCH -next v2] watch_queue: fix " Wei Yongjun 2020-01-22 7:48 ` Wei Yongjun 2021-05-19 14:16 [PATCH -next] watch_queue: Fix " Wei Yongjun
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200120085411.116252-1-weiyongjun1@huawei.com \ --to=weiyongjun1@huawei.com \ --cc=dhowells@redhat.com \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.