Re: [PATCH] mcstrans: fix inverted alias skip check in compute_trans_from_raw()

Stephen Smalley <[email protected]> Tue, 21 Jul 2026 08:51:35 -0400
Newsgroups org.kernel.vger.selinux
Message-ID <CAEjxPJ4aj0zgmUVxT-rTMGQDMBzBOuj3SaQ8=OSZBo9J0v=WjQ@mail.gmail.com>
On Thu, Jul 16, 2026 at 11:14 AM Stephen Smalley
<[email protected]> wrote:
>
> ebitmap_cmp() returns 1 when the bitmaps are equal. The
> skip-if-alias-of-last-bc test incorrectly was comparing to 0 as if it
> followed strcmp() semantics. Fix the comparison.
>
> Signed-off-by: Stephen Smalley <[email protected]>

Merged.

> ---
>  mcstrans/src/mcstrans.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c
> index e79aa3d5..8ed1aa95 100644
> --- a/mcstrans/src/mcstrans.c
> +++ b/mcstrans/src/mcstrans.c
> @@ -1623,8 +1623,7 @@ static char *compute_trans_from_raw(const char *level, domain_t *domain)
>                 if (l->sens == bc->level->sens) {
>                         /* skip if alias of last bc */
>                         if (last && last->level->sens == bc->level->sens &&
> -                           ebitmap_cmp(&last->level->cat, &bc->level->cat) ==
> -                                   0)
> +                           ebitmap_cmp(&last->level->cat, &bc->level->cat))
>                                 continue;
>
>                         /* compute bits not consumed by base classification */
> --
> 2.55.0
>