selinux: retain const qualifier on string literal in avtab_hash_eval()
authorChristian Göttsche <cgzones@googlemail.com>
Thu, 20 Apr 2023 15:05:02 +0000 (17:05 +0200)
committerPaul Moore <paul@paul-moore.com>
Mon, 8 May 2023 20:49:14 +0000 (16:49 -0400)
The second parameter `tag` of avtab_hash_eval() is only used for
printing.  In policydb_index() it is called with a string literal:

    avtab_hash_eval(&p->te_avtab, "rules");

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
[PM: slight formatting tweak in description]
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/ss/avtab.c
security/selinux/ss/avtab.h

index 8480ec6c6e75f69699da6ce7951a732561ce172d..6766edc0fe687cc97e64f77fb8eb1278369c0355 100644 (file)
@@ -354,7 +354,7 @@ int avtab_alloc_dup(struct avtab *new, const struct avtab *orig)
        return avtab_alloc_common(new, orig->nslot);
 }
 
-void avtab_hash_eval(struct avtab *h, char *tag)
+void avtab_hash_eval(struct avtab *h, const char *tag)
 {
        int i, chain_len, slots_used, max_chain_len;
        unsigned long long chain2_len_sum;
index d3ebea8d146f2d70bca2fa21f2cce0a0a21f5f77..d6742fd9c56064fc4ab20fd90d893c38fc8c14af 100644 (file)
@@ -92,7 +92,7 @@ int avtab_alloc(struct avtab *, u32);
 int avtab_alloc_dup(struct avtab *new, const struct avtab *orig);
 struct avtab_datum *avtab_search(struct avtab *h, const struct avtab_key *k);
 void avtab_destroy(struct avtab *h);
-void avtab_hash_eval(struct avtab *h, char *tag);
+void avtab_hash_eval(struct avtab *h, const char *tag);
 
 struct policydb;
 int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol,