From: John Johansen <john.johansen@canonical.com>
To: trix@redhat.com, jmorris@namei.org, serge@hallyn.com,
nathan@kernel.org, ndesaulniers@google.com
Cc: apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH] apparmor: fix aa_label_asxprint return check
Date: Sun, 13 Feb 2022 19:40:18 -0800 [thread overview]
Message-ID: <f42b0010-3a7b-e781-5b7e-ac975c36c102@canonical.com> (raw)
In-Reply-To: <20220213213228.2806682-1-trix@redhat.com>
On 2/13/22 13:32, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Clang static analysis reports this issue
> label.c:1802:3: warning: 2nd function call argument
> is an uninitialized value
> pr_info("%s", str);
> ^~~~~~~~~~~~~~~~~~
>
> str is set from a successful call to aa_label_asxprint(&str, ...)
> On failure a negative value is returned, not a -1. So change
> the check.
>
> Fixes: f1bd904175e8 ("apparmor: add the base fns() for domain labels")
> Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: John Johansen <john.johansen@canonical.com>
thanks I have pulled this into my tree
> ---
> security/apparmor/label.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/security/apparmor/label.c b/security/apparmor/label.c
> index 9eb9a9237926..a658b67c784c 100644
> --- a/security/apparmor/label.c
> +++ b/security/apparmor/label.c
> @@ -1744,7 +1744,7 @@ void aa_label_xaudit(struct audit_buffer *ab, struct aa_ns *ns,
> if (!use_label_hname(ns, label, flags) ||
> display_mode(ns, label, flags)) {
> len = aa_label_asxprint(&name, ns, label, flags, gfp);
> - if (len == -1) {
> + if (len < 0) {
> AA_DEBUG("label print error");
> return;
> }
> @@ -1772,7 +1772,7 @@ void aa_label_seq_xprint(struct seq_file *f, struct aa_ns *ns,
> int len;
>
> len = aa_label_asxprint(&str, ns, label, flags, gfp);
> - if (len == -1) {
> + if (len < 0) {
> AA_DEBUG("label print error");
> return;
> }
> @@ -1795,7 +1795,7 @@ void aa_label_xprintk(struct aa_ns *ns, struct aa_label *label, int flags,
> int len;
>
> len = aa_label_asxprint(&str, ns, label, flags, gfp);
> - if (len == -1) {
> + if (len < 0) {
> AA_DEBUG("label print error");
> return;
> }
prev parent reply other threads:[~2022-02-14 3:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-13 21:32 trix
2022-02-14 3:40 ` John Johansen [this message]
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=f42b0010-3a7b-e781-5b7e-ac975c36c102@canonical.com \
--to=john.johansen@canonical.com \
--cc=apparmor@lists.ubuntu.com \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=serge@hallyn.com \
--cc=trix@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®