[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHC9VhRVTMegCwVCVBmp8E9uHawYhpRkXicvOQL-djuTV7dAkg@mail.gmail.com>
Date: Tue, 3 May 2022 16:18:02 -0400
From: Paul Moore <paul@...l-moore.com>
To: Christian Göttsche <cgzones@...glemail.com>
Cc: selinux@...r.kernel.org,
Stephen Smalley <stephen.smalley.work@...il.com>,
Eric Paris <eparis@...isplace.org>,
Austin Kim <austin.kim@....com>,
Michal Orzel <michalorzel.eng@...il.com>,
Yang Li <yang.lee@...ux.alibaba.com>,
Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
Ondrej Mosnacek <omosnace@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selinux: use unsigned char for boolean values
On Mon, May 2, 2022 at 9:59 AM Christian Göttsche
<cgzones@...glemail.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@...glemail.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
Powered by blists - more mailing lists