diff mbox series

[5/6] selinux: retain const qualifier on string literal in avtab_hash_eval()

Message ID 20230420150503.22227-5-cgzones@googlemail.com (mailing list archive)
State Accepted
Delegated to: Paul Moore
Headers show
Series [1/6] selinux: do not leave dangling pointer behind | expand

Commit Message

Christian Göttsche April 20, 2023, 3:05 p.m. UTC
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>
---
 security/selinux/ss/avtab.c | 2 +-
 security/selinux/ss/avtab.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Paul Moore May 8, 2023, 8:50 p.m. UTC | #1
On Thu, Apr 20, 2023 at 11:05 AM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> 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>
> ---
>  security/selinux/ss/avtab.c | 2 +-
>  security/selinux/ss/avtab.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Merged into selinux/next, thanks.
diff mbox series

Patch

diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c
index 8480ec6c6e75..6766edc0fe68 100644
--- a/security/selinux/ss/avtab.c
+++ b/security/selinux/ss/avtab.c
@@ -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;
diff --git a/security/selinux/ss/avtab.h b/security/selinux/ss/avtab.h
index d3ebea8d146f..d6742fd9c560 100644
--- a/security/selinux/ss/avtab.h
+++ b/security/selinux/ss/avtab.h
@@ -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,