RE: [PATCH v2 5/9] selinux: services: update type for number of class permissions

From: David Laight
Date: Fri Aug 04 2023 - 11:21:40 EST


From: Paul Moore
> Sent: 04 August 2023 03:20
>
> On Jul 28, 2023 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@xxxxxxxxxxxxxx> wrote:
> >
...
> > + u16 i, n = mapping->num_perms;
...
> > for (; i < (sizeof(u32)*8); i++)

Don't dop arithmetic on types smaller than int.
You are pretty much requesting the compiler add code to mask the
result down to 16 bits after very operations.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)