From: Jiri Olsa <olsajiri@gmail.com>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com,
andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
yonghong.song@linux.dev, kpsingh@kernel.org, sdf@google.com,
haoluo@google.com, bpf@vger.kernel.org,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH v4 bpf-next 1/2] bpf: Fix uninitialized symbol in bpf_perf_link_fill_kprobe()
Date: Sat, 5 Aug 2023 21:58:58 +0200 [thread overview]
Message-ID: <ZM6qAt6gVSJIyy21@krava> (raw)
In-Reply-To: <20230804105732.3768-2-laoar.shao@gmail.com>
On Fri, Aug 04, 2023 at 10:57:31AM +0000, Yafang Shao wrote:
> The patch 1b715e1b0ec5: "bpf: Support ->fill_link_info for
> perf_event" from Jul 9, 2023, leads to the following Smatch static
> checker warning:
>
> kernel/bpf/syscall.c:3416 bpf_perf_link_fill_kprobe()
> error: uninitialized symbol 'type'.
>
> That can happens when uname is NULL. So fix it by verifying the uname
> when we really need to fill it.
>
> Fixes: 1b715e1b0ec5 ("bpf: Support ->fill_link_info for perf_event")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/bpf/85697a7e-f897-4f74-8b43-82721bebc462@kili.mountain/
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> Acked-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: Jiri Olsa <jolsa@kernel.org>
jirka
> ---
> kernel/bpf/syscall.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 7f4e8c3..166390f 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -3378,14 +3378,14 @@ static int bpf_perf_link_fill_common(const struct perf_event *event,
>
> if (!ulen ^ !uname)
> return -EINVAL;
> - if (!uname)
> - return 0;
>
> err = bpf_get_perf_event_info(event, &prog_id, fd_type, &buf,
> probe_offset, probe_addr);
> if (err)
> return err;
>
> + if (!uname)
> + return 0;
> if (buf) {
> len = strlen(buf);
> err = bpf_copy_to_user(uname, buf, ulen, len);
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2023-08-05 19:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 10:57 [PATCH v4 bpf-next 0/2] bpf: Fix fill_link_info and add selftest Yafang Shao
2023-08-04 10:57 ` [PATCH v4 bpf-next 1/2] bpf: Fix uninitialized symbol in bpf_perf_link_fill_kprobe() Yafang Shao
2023-08-05 19:58 ` Jiri Olsa [this message]
2023-08-04 10:57 ` [PATCH v4 bpf-next 2/2] selftests/bpf: Add selftest for fill_link_info Yafang Shao
2023-08-04 16:21 ` Yonghong Song
2023-08-05 2:25 ` Yafang Shao
2023-08-05 19:58 ` Jiri Olsa
2023-08-06 14:33 ` Yafang Shao
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=ZM6qAt6gVSJIyy21@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=laoar.shao@gmail.com \
--cc=martin.lau@linux.dev \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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.