Skip to content

Commit c0d1ade

Browse files
rgbriggsJames Morris
authored andcommitted
capabilities: invert logic for clarity
The way the logic was presented, it was awkward to read and verify. Invert the logic using DeMorgan's Law to be more easily able to read and understand. Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Reviewed-by: Serge Hallyn <serge@hallyn.com> Acked-by: James Morris <james.l.morris@oracle.com> Acked-by: Kees Cook <keescook@chromium.org> Okay-ished-by: Paul Moore <paul@paul-moore.com> Signed-off-by: James Morris <james.l.morris@oracle.com>
1 parent 02ebbaf commit c0d1ade

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎security/commoncap.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -782,10 +782,10 @@ static inline bool nonroot_raised_pE(struct cred *cred, kuid_t root)
782782
bool ret = false;
783783

784784
if (__cap_grew(effective, ambient, cred) &&
785-
(!__cap_full(effective, cred) ||
786-
!__is_eff(root, cred) ||
787-
!__is_real(root, cred) ||
788-
!root_privileged()))
785+
!(__cap_full(effective, cred) &&
786+
__is_eff(root, cred) &&
787+
__is_real(root, cred) &&
788+
root_privileged()))
789789
ret = true;
790790
return ret;
791791
}

0 commit comments

Comments
 (0)