Skip to content

Commit

Permalink
libsepol: drop unnecessary casts
Browse files Browse the repository at this point in the history
`hashtab_search()` does take `const_hashtab_key_t` as second parameter,
which is a typedef for `const char *`.
Drop the unnecessary and const-violating cast.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
  • Loading branch information
cgzones authored and jwcart2 committed Jun 24, 2021
1 parent 8111856 commit 4fbc018
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libsepol/src/services.c
Expand Up @@ -1182,7 +1182,7 @@ int sepol_string_to_security_class(const char *class_name,
class_datum_t *tclass_datum;

tclass_datum = hashtab_search(policydb->p_classes.table,
(hashtab_key_t) class_name);
class_name);
if (!tclass_datum) {
ERR(NULL, "unrecognized class %s", class_name);
return STATUS_ERR;
Expand Down Expand Up @@ -1211,7 +1211,7 @@ int sepol_string_to_av_perm(sepol_security_class_t tclass,
/* Check for unique perms then the common ones (if any) */
perm_datum = (perm_datum_t *)
hashtab_search(tclass_datum->permissions.table,
(hashtab_key_t)perm_name);
perm_name);
if (perm_datum != NULL) {
*av = 0x1 << (perm_datum->s.value - 1);
return STATUS_SUCCESS;
Expand All @@ -1222,7 +1222,7 @@ int sepol_string_to_av_perm(sepol_security_class_t tclass,

perm_datum = (perm_datum_t *)
hashtab_search(tclass_datum->comdatum->permissions.table,
(hashtab_key_t)perm_name);
perm_name);

if (perm_datum != NULL) {
*av = 0x1 << (perm_datum->s.value - 1);
Expand Down

0 comments on commit 4fbc018

Please sign in to comment.