diff options
author | 2024-12-16 17:40:02 +0100 | |
---|---|---|
committer | 2025-01-07 23:14:38 -0500 | |
commit | 5e99b81f48cd565a5341c921e62fd09184d6bb72 (patch) | |
tree | 0c3f0418be1ffdeed20e6ffc4932500c842dd7c3 /security/selinux | |
parent | selinux: constify and reconcile function parameter names (diff) | |
download | linux-rng-5e99b81f48cd565a5341c921e62fd09184d6bb72.tar.xz linux-rng-5e99b81f48cd565a5341c921e62fd09184d6bb72.zip |
selinux: rework match_ipv6_addrmask()
Constify parameters, add size hints, and simplify control flow.
According to godbolt the same assembly is generated.
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/ss/services.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 1c4ac392df2a..9bd14256a154 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -2597,17 +2597,15 @@ out: return rc; } -static int match_ipv6_addrmask(u32 *input, u32 *addr, u32 *mask) +static bool match_ipv6_addrmask(const u32 input[4], const u32 addr[4], const u32 mask[4]) { - int i, fail = 0; + int i; for (i = 0; i < 4; i++) - if (addr[i] != (input[i] & mask[i])) { - fail = 1; - break; - } + if (addr[i] != (input[i] & mask[i])) + return false; - return !fail; + return true; } /** |