Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932878AbbLXCQS (ORCPT ); Wed, 23 Dec 2015 21:16:18 -0500 Received: from mail.kernel.org ([198.145.29.136]:56127 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753790AbbLXCP0 (ORCPT ); Wed, 23 Dec 2015 21:15:26 -0500 From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 2/4] f2fs: return early when trying to read null nid Date: Wed, 23 Dec 2015 18:15:18 -0800 Message-Id: <1450923320-41113-2-git-send-email-jaegeuk@kernel.org> X-Mailer: git-send-email 2.5.4 (Apple Git-61) In-Reply-To: <1450923320-41113-1-git-send-email-jaegeuk@kernel.org> References: <1450923320-41113-1-git-send-email-jaegeuk@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 873 Lines: 30 If get_node_page() gets zero nid, we can return early without getting a wrong page. For example, get_dnode_of_data() can try to do that. Signed-off-by: Jaegeuk Kim --- fs/f2fs/node.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 341de5d..e17128d 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1059,6 +1059,9 @@ struct page *get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid) { struct page *page; int err; + + if (!nid) + return ERR_PTR(-ENOENT); repeat: page = grab_cache_page(NODE_MAPPING(sbi), nid); if (!page) -- 2.5.4 (Apple Git-61) -- 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/