From: Gu Zheng Date: Wed, 31 Jul 2013 20:53:29 +0000 (-0700) Subject: ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_... X-Git-Tag: v3.11-rc4~21^2~18 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=62c610460d73fcfa5637cb497c6923ef1c42b12d;p=~emulex%2Finfiniband.git ocfs2/refcounttree: add the missing NULL check of the return value of find_or_create_page() Add the missing NULL check of the return value of find_or_create_page() in function ocfs2_duplicate_clusters_by_page(). [akpm@linux-foundation.org: fix layout, per Joel] Signed-off-by: Gu Zheng Acked-by: Joel Becker Cc: Mark Fasheh Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 998b17eda09..9f6b96a0961 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c @@ -2965,6 +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