All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Carter <jwcart2@gmail.com>
To: Nicolas Iooss <nicolas.iooss@m4x.org>
Cc: SElinux list <selinux@vger.kernel.org>
Subject: Re: [PATCH userspace 1/1] libsepol: initialize s in constraint_expr_eval_reason
Date: Wed, 29 Jun 2022 16:06:48 -0400	[thread overview]
Message-ID: <CAP+JOzRXjoneNg4sQ3W9sMSneQETHqCw1yGUP1hdmXqbXXMwsQ@mail.gmail.com> (raw)
In-Reply-To: <20220629072055.2653695-1-nicolas.iooss@m4x.org>

On Wed, Jun 29, 2022 at 3:37 AM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>
> clang's static analyzer reports that s[0] can be uninitialized when used
> in:
>
>     sprintf(tmp_buf, "%s %s\n",
>                     xcontext ? "Validatetrans" : "Constraint",
>                     s[0] ? "GRANTED" : "DENIED");
>
> Silence this false-positive issue by making s always initialized.
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>

Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  libsepol/src/services.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libsepol/src/services.c b/libsepol/src/services.c
> index d7510e9dae51..db769cdcfaf9 100644
> --- a/libsepol/src/services.c
> +++ b/libsepol/src/services.c
> @@ -394,7 +394,7 @@ static int constraint_expr_eval_reason(context_struct_t *scontext,
>         role_datum_t *r1, *r2;
>         mls_level_t *l1, *l2;
>         constraint_expr_t *e;
> -       int s[CEXPR_MAXDEPTH];
> +       int s[CEXPR_MAXDEPTH] = {};
>         int sp = -1;
>         char tmp_buf[128];
>
> --
> 2.36.1
>

  reply	other threads:[~2022-06-29 20:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29  7:20 [PATCH userspace 1/1] libsepol: initialize s in constraint_expr_eval_reason Nicolas Iooss
2022-06-29 20:06 ` James Carter [this message]
2022-07-01  9:21   ` Christian Göttsche
2022-07-06 20:11   ` James Carter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP+JOzRXjoneNg4sQ3W9sMSneQETHqCw1yGUP1hdmXqbXXMwsQ@mail.gmail.com \
    --to=jwcart2@gmail.com \
    --cc=nicolas.iooss@m4x.org \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.