From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758619AbdEXCFv convert rfc822-to-8bit (ORCPT ); Tue, 23 May 2017 22:05:51 -0400 Received: from prv-mh.provo.novell.com ([137.65.248.74]:52497 "EHLO prv-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751620AbdEXCFt (ORCPT ); Tue, 23 May 2017 22:05:49 -0400 Message-Id: <59255AF8020000F900077D21@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.2 Date: Tue, 23 May 2017 20:05:44 -0600 From: "Gang He" To: Cc: , , , Subject: Re: [PATCH v2] ocfs2: fix a static checker warning References: <1495516634-1952-1-git-send-email-ghe@suse.com> <20170523153023.9831db2fd6d5403445509cf3@linux-foundation.org> In-Reply-To: <20170523153023.9831db2fd6d5403445509cf3@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Andrew, I am sorry that I did not write which static code checker tool, since I did not get the name from Dan, I think the tool should be like Coverity code checking tool. Second, set the initial value of local variable rc to -ESTALE from zero, this change will make the code logic is strict consistent with before the commit d56a8f32e4c6 ("ocfs2: check/fix inode block for online file check"), although it is very difficult to meet this problem in the real environment. Thanks Gang >>> > On Tue, 23 May 2017 13:17:14 +0800 Gang He wrote: > >> This patch will fix a static code checker warning, which looks >> like below, >> fs/ocfs2/inode.c:179 ocfs2_iget() >> warn: passing zero to 'ERR_PTR' >> >> this warning was caused by the >> commit d56a8f32e4c6 ("ocfs2: check/fix inode block for online file check"). >> after apply this patch, the error return value will not be NULL(zero). >> >> Signed-off-by: Gang He >> --- >> fs/ocfs2/inode.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c >> index 382401d..1a1e007 100644 >> --- a/fs/ocfs2/inode.c >> +++ b/fs/ocfs2/inode.c >> @@ -136,7 +136,7 @@ struct inode *ocfs2_ilookup(struct super_block *sb, u64 > blkno) >> struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned > flags, >> int sysfile_type) >> { >> - int rc = 0; >> + int rc = -ESTALE; >> struct inode *inode = NULL; >> struct super_block *sb = osb->sb; >> struct ocfs2_find_inode_args args; > > hm, OK, thanks. The resulting code still looks rather weird. Could > someone who works in this area please take a look?