avc: remove unnecessary pointer reassignment
PATCH 1/1 avc: remove unnecessary pointer reassignment
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.
--- security/selinux/avc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
security/selinux/avc.c +2 -4
@@ -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))
Signature · 1 line
2.2.0.rc0.207.ga3a616c
Quoted 36 lines · Jeff Vander Stoep
Commit
f01e1af445fa("selinux: don't pass in NULL avd toavc_has_perm_noaudit") made this pointer reassignment unnecessary. Avd should continue to reference the stack-based copy.Signed-off-by Jeff Vander Stoep <[email protected]>--- security/selinux/avc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)security/selinux/avc.c +2
-5@@ -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)) --2.2.0.rc0.207.ga3a616c
_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].
Signature · 1 line
Nick Kralevich | Android Security | [email protected] | 650.214.4037
Quoted 5 lines · Jeff Vander Stoep
Commit
f01e1af445fa("selinux: don't pass in NULL avd toavc_has_perm_noaudit") made this pointer reassignment unnecessary. Avd should continue to reference the stack-based copy.Signed-off-by Jeff Vander Stoep <[email protected]>
Quoted 24 lines
--- security/selinux/avc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)security/selinux/avc.c +2
-4@@ -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
maintainerQuoted 8 lines · Stephen Smalley
Quoted 5 lines · Jeff Vander Stoep
Commit
f01e1af445fa("selinux: don't pass in NULL avd toavc_has_perm_noaudit") made this pointer reassignment unnecessary. Avd should continue to reference the stack-based copy.Signed-off-by Jeff Vander Stoep <[email protected]>Acked-by Stephen Smalley <[email protected]>
Thanks everyone for the patch and the review. I'll merge this next week into selinux#next.
Quoted 25 lines
Quoted 24 lines
--- security/selinux/avc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)security/selinux/avc.c +2
-4@@ -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))
Signature · 2 lines
paul moore www.paul-moore.com
Paul Moore
maintainerQuoted 6 lines · Paul Moore
Quoted 5 lines · Stephen Smalley
Quoted 4 lines · Jeff Vander Stoep
Commit
f01e1af445fa("selinux: don't pass in NULL avd toavc_has_perm_noaudit") made this pointer reassignment unnecessary. Avd should continue to reference the stack-based copy.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Jeff Vander Stoep <[email protected]>Acked-by Stephen Smalley <[email protected]>Thanks everyone for the patch and the review. I'll merge this next week into selinux#next.
I apologize for the delay, but I just merged this into selinux#next; it should be in the next linux-next kernel.
Signature · 2 lines
paul moore www.paul-moore.com