Re: [PATCH] libsepol: use bool instead of int in validation functions

Stephen Smalley <[email protected]>
Newsgroups org.kernel.vger.selinux
Message-ID <CAEjxPJ6NGxMic8PVrHZX6OtUMewp+WSfqsc2KDLso5=nKdUHng@mail.gmail.com>
On Mon, Aug 17, 2026 at 9:35 AM Stephen Smalley
<[email protected]> wrote:
>
> On Mon, Aug 17, 2026 at 8:43 AM Stephen Smalley
> <[email protected]> wrote:
> >
> > On Fri, Aug 14, 2026 at 7:32 PM Kalevi Kolttonen <[email protected]> wrote:
> > >
> > > This is an effort to use boolean return values instead of
> > > int in as many libsepol validation functions as possible.
> > > The functions passed to hashtab_map() have been kept as is
> > > to avoid excessive reworking of the codebase.
> > >
> > > The change from int to bool requires adjusting the callers
> > > to invert their return value checking logic. The caller
> > > conversion has been performed to keep the existing logic
> > > intact.
> > >
> > > Signed-off-by: Kalevi Kolttonen <[email protected]>
> >
> > I am hesitant to apply this patch for the following reasons:
> > 1. It changes the semantics of the return type of a function that is
> > exposed to multiple source files,
> > 2. It does not rename the functions to make the change in return type
> > explicit and ensure all
> > callers are updated.
> > 3. It doesn't provide any runtime or memory benefit.
> >
> > Other SELinux userspace maintainers are free to disagree with me and
> > merge it if they desire.
>
> Also, your patch breaks building the fuzzers due to missing #include
> <stdbool.h>;
> to reproduce, run ./scripts/oss-fuzz.sh to build the fuzzers.

One last reason to not apply this patch: it makes the code less
consistent, not more, since as you said, you don't convert all the
functions to reduce the scope of the change. I'd rather keep it
consistent.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.