selinux: do not discard const qualifier in cast
authorChristian Göttsche <cgzones@googlemail.com>
Tue, 25 Jan 2022 14:14:17 +0000 (15:14 +0100)
committerPaul Moore <paul@paul-moore.com>
Wed, 26 Jan 2022 20:54:45 +0000 (15:54 -0500)
Do not discard the const qualifier on the cast from const void* to
__be32*; the addressed value is not modified.

Reported by clang [-Wcast-qual]

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/netnode.c

index 4a7d2ab5b96099b32855ebb29e4921688f043aa3..889552db0d31a1715655883c55bce6d9ba881d6b 100644 (file)
@@ -107,7 +107,7 @@ static struct sel_netnode *sel_netnode_find(const void *addr, u16 family)
 
        switch (family) {
        case PF_INET:
-               idx = sel_netnode_hashfn_ipv4(*(__be32 *)addr);
+               idx = sel_netnode_hashfn_ipv4(*(const __be32 *)addr);
                break;
        case PF_INET6:
                idx = sel_netnode_hashfn_ipv6(addr);
@@ -121,7 +121,7 @@ static struct sel_netnode *sel_netnode_find(const void *addr, u16 family)
                if (node->nsec.family == family)
                        switch (family) {
                        case PF_INET:
-                               if (node->nsec.addr.ipv4 == *(__be32 *)addr)
+                               if (node->nsec.addr.ipv4 == *(const __be32 *)addr)
                                        return node;
                                break;
                        case PF_INET6: