All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Carter <jwcart2@gmail.com>
To: "Christian Göttsche" <cgzones@googlemail.com>
Cc: SElinux list <selinux@vger.kernel.org>
Subject: Re: [PATCH 03/23] libsepol: remove unused functions
Date: Mon, 21 Jun 2021 16:54:07 -0400	[thread overview]
Message-ID: <CAP+JOzSG0FaTwHS9m2dbr=8gd2BTXR4N1+ZOcrVaGYJJWOJyWA@mail.gmail.com> (raw)
In-Reply-To: <20210608155912.32047-4-cgzones@googlemail.com>

On Tue, Jun 8, 2021 at 12:00 PM Christian Göttsche
<cgzones@googlemail.com> wrote:
>
> The functions `role_set_get_role`, `sepol_validate_transition` and
> `sepol_sidtab_remove` seem to be unused since the initial import.
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  libsepol/src/policydb.c | 18 ----------------
>  libsepol/src/services.c | 47 -----------------------------------------
>  libsepol/src/sidtab.c   | 31 ---------------------------
>  3 files changed, 96 deletions(-)
>
> diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
> index 3f7ddb11..fc1d0711 100644
> --- a/libsepol/src/policydb.c
> +++ b/libsepol/src/policydb.c
> @@ -1791,24 +1791,6 @@ int type_set_or_eq(type_set_t * dst, type_set_t * other)
>         return ret;
>  }
>
> -int role_set_get_role(role_set_t * x, uint32_t role)
> -{
> -       if (x->flags & ROLE_STAR)
> -               return 1;
> -
> -       if (ebitmap_get_bit(&x->roles, role - 1)) {
> -               if (x->flags & ROLE_COMP)
> -                       return 0;
> -               else
> -                       return 1;
> -       } else {
> -               if (x->flags & ROLE_COMP)
> -                       return 1;
> -               else
> -                       return 0;
> -       }
> -}
> -
>  /***********************************************************************/
>  /* everything below is for policy reads */
>
> diff --git a/libsepol/src/services.c b/libsepol/src/services.c
> index 39fbd979..ff91f7d2 100644
> --- a/libsepol/src/services.c
> +++ b/libsepol/src/services.c
> @@ -1024,53 +1024,6 @@ static int context_struct_compute_av(context_struct_t * scontext,
>         return 0;
>  }
>
> -static int sepol_validate_transition(sepol_security_id_t oldsid,
> -                                    sepol_security_id_t newsid,
> -                                    sepol_security_id_t tasksid,
> -                                    sepol_security_class_t tclass)
> -{
> -       context_struct_t *ocontext;
> -       context_struct_t *ncontext;
> -       context_struct_t *tcontext;
> -       class_datum_t *tclass_datum;
> -       constraint_node_t *constraint;
> -
> -       if (!tclass || tclass > policydb->p_classes.nprim) {
> -               ERR(NULL, "unrecognized class %d", tclass);
> -               return -EINVAL;
> -       }
> -       tclass_datum = policydb->class_val_to_struct[tclass - 1];
> -
> -       ocontext = sepol_sidtab_search(sidtab, oldsid);
> -       if (!ocontext) {
> -               ERR(NULL, "unrecognized SID %d", oldsid);
> -               return -EINVAL;
> -       }
> -
> -       ncontext = sepol_sidtab_search(sidtab, newsid);
> -       if (!ncontext) {
> -               ERR(NULL, "unrecognized SID %d", newsid);
> -               return -EINVAL;
> -       }
> -
> -       tcontext = sepol_sidtab_search(sidtab, tasksid);
> -       if (!tcontext) {
> -               ERR(NULL, "unrecognized SID %d", tasksid);
> -               return -EINVAL;
> -       }
> -
> -       constraint = tclass_datum->validatetrans;
> -       while (constraint) {
> -               if (!constraint_expr_eval_reason(ocontext, ncontext, tcontext,
> -                                         0, constraint, NULL, 0)) {
> -                       return -EPERM;
> -               }
> -               constraint = constraint->next;
> -       }
> -
> -       return 0;
> -}
> -
>  /*
>   * sepol_validate_transition_reason_buffer - the reason buffer is realloc'd
>   * in the constraint_expr_eval_reason() function.
> diff --git a/libsepol/src/sidtab.c b/libsepol/src/sidtab.c
> index e6bf5716..255e0725 100644
> --- a/libsepol/src/sidtab.c
> +++ b/libsepol/src/sidtab.c
> @@ -84,37 +84,6 @@ int sepol_sidtab_insert(sidtab_t * s, sepol_security_id_t sid,
>         return 0;
>  }
>
> -int sepol_sidtab_remove(sidtab_t * s, sepol_security_id_t sid)
> -{
> -       int hvalue;
> -       sidtab_node_t *cur, *last;
> -
> -       if (!s || !s->htable)
> -               return -ENOENT;
> -
> -       hvalue = SIDTAB_HASH(sid);
> -       last = NULL;
> -       cur = s->htable[hvalue];
> -       while (cur != NULL && sid > cur->sid) {
> -               last = cur;
> -               cur = cur->next;
> -       }
> -
> -       if (cur == NULL || sid != cur->sid)
> -               return -ENOENT;
> -
> -       if (last == NULL)
> -               s->htable[hvalue] = cur->next;
> -       else
> -               last->next = cur->next;
> -
> -       context_destroy(&cur->context);
> -
> -       free(cur);
> -       s->nel--;
> -       return 0;
> -}
> -
>  context_struct_t *sepol_sidtab_search(sidtab_t * s, sepol_security_id_t sid)
>  {
>         int hvalue;
> --
> 2.32.0
>

  reply	other threads:[~2021-06-21 20:54 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 15:58 [PATCH 00/23] libsepol: miscellaneous cleanup Christian Göttsche
2021-06-08 15:58 ` [PATCH 01/23] libsepol: fix typos Christian Göttsche
2021-06-21 20:54   ` James Carter
2021-06-08 15:58 ` [PATCH 02/23] libsepol: resolve missing prototypes Christian Göttsche
2021-06-21 20:55   ` James Carter
2021-06-08 15:58 ` [PATCH 03/23] libsepol: remove unused functions Christian Göttsche
2021-06-21 20:54   ` James Carter [this message]
2021-06-08 15:58 ` [PATCH 04/23] libsepol: ignore UBSAN false-positives Christian Göttsche
2021-06-09 13:44   ` Ondrej Mosnacek
2021-06-09 14:05   ` James Carter
2021-07-01 18:06   ` [PATCH v2 1/3] " Christian Göttsche
2021-07-12  7:34     ` Nicolas Iooss
2021-07-13 19:59       ` Nicolas Iooss
2021-06-08 15:58 ` [PATCH 05/23] libsepol: avoid implicit conversions Christian Göttsche
2021-06-09 13:47   ` Ondrej Mosnacek
2021-07-01 18:06   ` [PATCH v2 2/3] " Christian Göttsche
2021-07-12  7:36     ` Nicolas Iooss
2021-07-13 20:01       ` Nicolas Iooss
2021-06-08 15:58 ` [PATCH 06/23] libsepol: avoid unsigned integer overflow Christian Göttsche
2021-06-21 20:58   ` James Carter
2021-06-08 15:58 ` [PATCH 07/23] libsepol: follow declaration-after-statement Christian Göttsche
2021-06-21 20:57   ` James Carter
2021-06-08 15:58 ` [PATCH 08/23] libsepol/cil: " Christian Göttsche
2021-06-21 20:56   ` James Carter
2021-06-08 15:58 ` [PATCH 09/23] libsepol: remove dead stores Christian Göttsche
2021-06-08 15:58 ` [PATCH 10/23] libsepol: mark read-only parameters of ebitmap interfaces const Christian Göttsche
2021-06-21 20:55   ` James Carter
2021-06-08 15:59 ` [PATCH 11/23] libsepol: mark read-only parameters of type_set_ " Christian Göttsche
2021-06-21 20:58   ` James Carter
2021-06-08 15:59 ` [PATCH 12/23] libsepol: do not allocate memory of size 0 Christian Göttsche
2021-06-21 20:59   ` James Carter
2021-06-08 15:59 ` [PATCH 13/23] libsepol: assure string NUL-termination Christian Göttsche
2021-06-09 14:38   ` James Carter
2021-07-01 18:07   ` [PATCH v2 3/3] libsepol: assure string NUL-termination of ibdev_name Christian Göttsche
2021-07-12  7:35     ` Nicolas Iooss
2021-07-13 19:59       ` Nicolas Iooss
2021-06-08 15:59 ` [PATCH 14/23] libsepol: remove dead stores Christian Göttsche
2021-06-08 15:59 ` [PATCH 15/23] libsepol/cil: silence cast warning Christian Göttsche
2021-06-21 20:58   ` James Carter
2021-06-08 15:59 ` [PATCH 16/23] libsepol/cil: drop extra semicolon Christian Göttsche
2021-06-21 20:57   ` James Carter
2021-06-08 15:59 ` [PATCH 17/23] libsepol/cil: drop dead store Christian Göttsche
2021-06-21 20:56   ` James Carter
2021-06-08 15:59 ` [PATCH 18/23] libsepol/cil: drop unnecessary casts Christian Göttsche
2021-06-21 20:55   ` James Carter
2021-06-08 15:59 ` [PATCH 19/23] libsepol/cil: avoid using maybe uninitialized variables Christian Göttsche
2021-06-21 21:00   ` James Carter
2021-06-08 15:59 ` [PATCH 20/23] libsepol: drop repeated semicolons Christian Göttsche
2021-06-21 20:54   ` James Carter
2021-06-08 15:59 ` [PATCH 21/23] libsepol: drop unnecessary casts Christian Göttsche
2021-06-21 20:57   ` James Carter
2021-06-08 15:59 ` [PATCH 22/23] libsepol: declare file local variable static Christian Göttsche
2021-06-21 21:00   ` James Carter
2021-06-08 15:59 ` [PATCH 23/23] libsepol: declare read-only arrays const Christian Göttsche
2021-06-21 20:59   ` James Carter
2021-06-24 14:29 ` [PATCH 00/23] libsepol: miscellaneous cleanup James Carter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAP+JOzSG0FaTwHS9m2dbr=8gd2BTXR4N1+ZOcrVaGYJJWOJyWA@mail.gmail.com' \
    --to=jwcart2@gmail.com \
    --cc=cgzones@googlemail.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.