All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
To: mfasheh@suse.com, jlbec@evilplan.org
Cc: ocfs2-devel@oss.oracle.com, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_page()
Date: Mon, 08 Jul 2013 15:52:53 +0800	[thread overview]
Message-ID: <51DA6FD5.8050300@cn.fujitsu.com> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
To: mfasheh@suse.com, jlbec@evilplan.org
Cc: ocfs2-devel@oss.oracle.com, linux-kernel <linux-kernel@vger.kernel.org>
Subject: [Ocfs2-devel] [PATCH] ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_page()
Date: Mon, 08 Jul 2013 07:56:25 -0000	[thread overview]
Message-ID: <51DA6FD5.8050300@cn.fujitsu.com> (raw)

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

             reply	other threads:[~2013-07-08  7:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-08  7:52 Gu Zheng [this message]
2013-07-08  7:56 ` [Ocfs2-devel] [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-09 22:11   ` [Ocfs2-devel] " Joel Becker
2013-07-10  1:23   ` Gu Zheng
2013-07-10  1:26     ` [Ocfs2-devel] " Gu Zheng

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=51DA6FD5.8050300@cn.fujitsu.com \
    --to=guz.fnst@cn.fujitsu.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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: link
Be 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.