Re: [PATCH -next] watch_queue: Fix error return code in watch_queue_set_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wei Yongjun <weiyongjun1@xxxxxxxxxx> 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;





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux