• Zhen Lei's avatar
    selinux: simplify avc_xperms_audit_required() · 68cfb283
    Zhen Lei authored
    By associative and commutative laws, the result of the two 'audited' is
    zero. Take the second 'audited' as an example:
      1) audited = requested & avd->auditallow;
      2) audited &= ~requested;
      ==> audited = ~requested & (requested & avd->auditallow);
      ==> audited = (~requested & requested) & avd->auditallow;
      ==> audited = 0 & avd->auditallow;
      ==> audited = 0;
    
    In fact, it is more readable to directly write zero. The value of the
    first 'audited' is 0 because AUDIT is not allowed. The second 'audited'
    is zero because there is no AUDITALLOW permission.
    Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
    Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
    68cfb283
avc.c 30.7 KB