lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ