lkml.org 
[lkml]   [2022]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] selinux: use unsigned char for boolean values
On Mon, May 2, 2022 at 9:59 AM Christian Göttsche
<cgzones@googlemail.com> 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@googlemail.com>
> ---
> 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

\
 
 \ /
  Last update: 2022-05-03 22:19    [W:0.054 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site