From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759062AbbCDSHc (ORCPT ); Wed, 4 Mar 2015 13:07:32 -0500 Received: from mail-ob0-f174.google.com ([209.85.214.174]:41053 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758983AbbCDSH2 (ORCPT ); Wed, 4 Mar 2015 13:07:28 -0500 MIME-Version: 1.0 X-Originating-IP: [24.43.226.170] In-Reply-To: <54F06DF1.8070605@tycho.nsa.gov> References: <1424987742-15120-1-git-send-email-jeffv@google.com> <54F06DF1.8070605@tycho.nsa.gov> Date: Wed, 4 Mar 2015 13:07:27 -0500 Message-ID: Subject: Re: [PATCH] avc: remove unnecessary pointer reassignment From: Paul Moore To: Stephen Smalley Cc: Jeff Vander Stoep , jvanderstoep@gmail.com, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, James Morris , selinux@tycho.nsa.gov, Eric Paris Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 27, 2015 at 8:15 AM, Stephen Smalley wrote: > On 02/26/2015 04:54 PM, Jeff Vander Stoep wrote: >> Commit f01e1af445fa ("selinux: don't pass in NULL avd to avc_has_perm_noaudit") >> made this pointer reassignment unnecessary. Avd should continue to reference >> the stack-based copy. >> >> Signed-off-by: Jeff Vander Stoep > > Acked-by: Stephen Smalley Thanks everyone for the patch and the review. I'll merge this next week into selinux#next. >> --- >> security/selinux/avc.c | 6 ++---- >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/security/selinux/avc.c b/security/selinux/avc.c >> index afcc0ae..3c17dda 100644 >> --- a/security/selinux/avc.c >> +++ b/security/selinux/avc.c >> @@ -724,12 +724,10 @@ inline int avc_has_perm_noaudit(u32 ssid, u32 tsid, >> rcu_read_lock(); >> >> node = avc_lookup(ssid, tsid, tclass); >> - if (unlikely(!node)) { >> + if (unlikely(!node)) >> node = avc_compute_av(ssid, tsid, tclass, avd); >> - } else { >> + else >> memcpy(avd, &node->ae.avd, sizeof(*avd)); >> - avd = &node->ae.avd; >> - } >> >> denied = requested & ~(avd->allowed); >> if (unlikely(denied)) >> > -- paul moore www.paul-moore.com