Re: [PATCH 4/6] selinux: simplify avtab slot calculation

From: Paul Moore
Date: Wed Sep 13 2023 - 13:47:04 EST


On Aug 18, 2023 Stephen Smalley <stephen.smalley.work@xxxxxxxxx> wrote:
>
> Instead of dividing by 8 and then performing log2 by hand, use a more
> readable calculation.
>
> The behavior of rounddown_pow_of_two() for an input of 0 is undefined,
> so handle that case and small values manually to achieve the same
> results.
>
> Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
> Reviewed-by: Stephen Smalley <stephen.smalley.work@xxxxxxxxx>
> ---
> security/selinux/ss/avtab.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)

Much nicer, thanks. Merged into selinux/next.

--
paul-moore.com