Re: [PATCH 21/23] libsepol: drop unnecessary casts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 8, 2021 at 12:02 PM Christian Göttsche
<cgzones@xxxxxxxxxxxxxx> wrote:
>
> `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@xxxxxxxxxxxxxx>

Acked-by: James Carter <jwcart2@xxxxxxxxx>

> ---
>  libsepol/src/services.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libsepol/src/services.c b/libsepol/src/services.c
> index f7c31d80..47a3dc14 100644
> --- a/libsepol/src/services.c
> +++ b/libsepol/src/services.c
> @@ -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;
> @@ -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;
> @@ -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);
> --
> 2.32.0
>




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux