From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Layton Subject: [PATCH v5 1/9] audit: remove unnecessary NULL ptr checks from do_path_lookup Date: Thu, 26 Jul 2012 07:21:05 -0400 Message-ID: <1343301673-10642-2-git-send-email-jlayton@redhat.com> References: <1343301673-10642-1-git-send-email-jlayton@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.21]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6QBLN0Q032765 for ; Thu, 26 Jul 2012 07:21:23 -0400 Received: from mail-gg0-f174.google.com (mail-gg0-f174.google.com [209.85.161.174]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6QBLLt1011478 for ; Thu, 26 Jul 2012 07:21:21 -0400 Received: by gglu4 with SMTP id u4so1952946ggl.33 for ; Thu, 26 Jul 2012 04:21:21 -0700 (PDT) In-Reply-To: <1343301673-10642-1-git-send-email-jlayton@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: eparis@redhat.com, viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-audit@redhat.com, linux-kernel@vger.kernel.org List-Id: linux-audit@redhat.com As best I can tell, whenever retval == 0, nd->path.dentry and nd->inode are also non-NULL. Eliminate those checks and the superfluous audit_context check. Signed-off-by: Eric Paris Signed-off-by: Jeff Layton --- fs/namei.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 0b951d4..f252f36 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1856,12 +1856,8 @@ static int do_path_lookup(int dfd, const char *name, if (unlikely(retval == -ESTALE)) retval = path_lookupat(dfd, name, flags | LOOKUP_REVAL, nd); - if (likely(!retval)) { - if (unlikely(!audit_dummy_context())) { - if (nd->path.dentry && nd->inode) - audit_inode(name, nd->path.dentry); - } - } + if (likely(!retval)) + audit_inode(name, nd->path.dentry); return retval; } -- 1.7.11.2