public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_page()
@ 2013-07-08  7:52 Gu Zheng
  2013-07-09 22:11 ` Joel Becker
  0 siblings, 1 reply; 3+ messages in thread
From: Gu Zheng @ 2013-07-08  7:52 UTC (permalink / raw)
  To: mfasheh, jlbec; +Cc: ocfs2-devel, linux-kernel

Add the missing NULL check of the return value of find_or_create_page() in
function ocfs2_duplicate_clusters_by_page().

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
 fs/ocfs2/refcounttree.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 998b17e..456d0e4 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -2965,7 +2965,11 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle,
 			to = map_end & (PAGE_CACHE_SIZE - 1);

 		page = find_or_create_page(mapping, page_index, GFP_NOFS);
-
+		if (!page) {
+			ret = -ENOMEM;
+			mlog_errno(ret);
+			break;
+		}
 		/*
 		 * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page
 		 * can't be dirtied before we CoW it out.
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_page()
  2013-07-08  7:52 [PATCH] ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_page() Gu Zheng
@ 2013-07-09 22:11 ` Joel Becker
  2013-07-10  1:23   ` Gu Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Becker @ 2013-07-09 22:11 UTC (permalink / raw)
  To: Gu Zheng; +Cc: mfasheh, ocfs2-devel, linux-kernel

On Mon, Jul 08, 2013 at 03:52:53PM +0800, Gu Zheng wrote:
> Add the missing NULL check of the return value of find_or_create_page() in
> function ocfs2_duplicate_clusters_by_page().
> 
> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
> ---
>  fs/ocfs2/refcounttree.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
> index 998b17e..456d0e4 100644
> --- a/fs/ocfs2/refcounttree.c
> +++ b/fs/ocfs2/refcounttree.c
> @@ -2965,7 +2965,11 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle,
>  			to = map_end & (PAGE_CACHE_SIZE - 1);
> 
>  		page = find_or_create_page(mapping, page_index, GFP_NOFS);
> -
> +		if (!page) {
> +			ret = -ENOMEM;
> +			mlog_errno(ret);
> +			break;
> +		}
>  		/*
>  		 * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page
>  		 * can't be dirtied before we CoW it out.

Put a blank line between the closing brace and the comment.  Otherwise,
Acked-by: Joel Becker <jlbec@evilplan.org>

Joel
> -- 
> 1.7.7
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 

Life's Little Instruction Book #99

	"Think big thoughts, but relish small pleasures."

			http://www.jlbec.org/
			jlbec@evilplan.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_page()
  2013-07-09 22:11 ` Joel Becker
@ 2013-07-10  1:23   ` Gu Zheng
  0 siblings, 0 replies; 3+ messages in thread
From: Gu Zheng @ 2013-07-10  1:23 UTC (permalink / raw)
  To: mfasheh, ocfs2-devel, linux-kernel

On 07/10/2013 06:11 AM, Joel Becker wrote:

> On Mon, Jul 08, 2013 at 03:52:53PM +0800, Gu Zheng wrote:
>> Add the missing NULL check of the return value of find_or_create_page() in
>> function ocfs2_duplicate_clusters_by_page().
>>
>> Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
>> ---
>>  fs/ocfs2/refcounttree.c |    6 +++++-
>>  1 files changed, 5 insertions(+), 1 deletions(-)
>>
>> diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
>> index 998b17e..456d0e4 100644
>> --- a/fs/ocfs2/refcounttree.c
>> +++ b/fs/ocfs2/refcounttree.c
>> @@ -2965,7 +2965,11 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle,
>>  			to = map_end & (PAGE_CACHE_SIZE - 1);
>>
>>  		page = find_or_create_page(mapping, page_index, GFP_NOFS);
>> -
>> +		if (!page) {
>> +			ret = -ENOMEM;
>> +			mlog_errno(ret);
>> +			break;
>> +		}
>>  		/*
>>  		 * In case PAGE_CACHE_SIZE <= CLUSTER_SIZE, This page
>>  		 * can't be dirtied before we CoW it out.
> 
> Put a blank line between the closing brace and the comment.  Otherwise,

Got it.:)

> Acked-by: Joel Becker <jlbec@evilplan.org>

Thanks~

Regards,
Gu

> 
> Joel
>> -- 
>> 1.7.7
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-10  1:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-08  7:52 [PATCH] ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_page() Gu Zheng
2013-07-09 22:11 ` Joel Becker
2013-07-10  1:23   ` Gu Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox