Skip to content

Commit

Permalink
capabilities: invert logic for clarity
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Serge Hallyn <[email protected]>
Acked-by: James Morris <[email protected]>
Acked-by: Kees Cook <[email protected]>
Okay-ished-by: Paul Moore <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
rgbriggs authored and James Morris committed Oct 20, 2017
1 parent 02ebbaf commit c0d1ade
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions security/commoncap.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,10 +782,10 @@ static inline bool nonroot_raised_pE(struct cred *cred, kuid_t root)
bool ret = false;

if (__cap_grew(effective, ambient, cred) &&
(!__cap_full(effective, cred) ||
!__is_eff(root, cred) ||
!__is_real(root, cred) ||
!root_privileged()))
!(__cap_full(effective, cred) &&
__is_eff(root, cred) &&
__is_real(root, cred) &&
root_privileged()))
ret = true;
return ret;
}
Expand Down

0 comments on commit c0d1ade

Please sign in to comment.