Re: [PATCH] selinux: use unsigned char for boolean values

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

 



On Mon, May 2, 2022 at 9:59 AM Christian Göttsche
<cgzones@xxxxxxxxxxxxxx> wrote:
>
> Reported by sparse:
>
>     security/selinux/selinuxfs.c:1483:30: warning: incorrect type in assignment (different signedness)
>     security/selinux/selinuxfs.c:1483:30:    expected unsigned int *
>     security/selinux/selinuxfs.c:1483:30:    got int *[addressable] values
>     security/selinux/selinuxfs.c:1400:48: warning: incorrect type in argument 3 (different signedness)
>     security/selinux/selinuxfs.c:1400:48:    expected int *values
>     security/selinux/selinuxfs.c:1400:48:    got unsigned int *bool_pending_values
>
> Also mark the read-only boolean array parameter of security_set_bools()
> const.
>
> Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
> ---
>  security/selinux/include/conditional.h |  4 ++--
>  security/selinux/selinuxfs.c           | 12 ++++++------
>  security/selinux/ss/policydb.h         |  2 +-
>  security/selinux/ss/services.c         | 13 +++++++------
>  4 files changed, 16 insertions(+), 15 deletions(-)

I could understand fixing the signed/unsigned type mismatch, but I
don't quite understand the move from an int type to a char; is it
simply to save space, i.e. 32-bits vs 8-bits?  I think I would prefer
either simply fixing the signed/unsigned mismatch and leaving the
booleans as ints, or moving completely to a bool type, although that
is likely to be much more involved.

-- 
paul-moore.com




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

  Powered by Linux