mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
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>
This commit is contained in:
parent
9090308510
commit
5e99b81f48
|
|
@ -2597,17 +2597,15 @@ int security_netif_sid(char *name, u32 *if_sid)
|
|||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user