[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fUPz9R60Lay=k-0k5Q8C9AdStAMycOgsKqA5MJ_o7Ag3Q@mail.gmail.com>
Date: Mon, 17 Mar 2025 08:44:45 -0700
From: Ian Rogers <irogers@...gle.com>
To: Feng Yang <yangfeng59949@....com>
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
namhyung@...nel.org, mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...nel.org, adrian.hunter@...el.com, kan.liang@...ux.intel.com,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf kwork: Remove unreachable judgments
On Thu, Mar 13, 2025 at 8:10 PM Feng Yang <yangfeng59949@....com> wrote:
>
> From: Feng Yang <yangfeng@...inos.cn>
>
> When s2[i] = '\0', if s1[i] != '\0', it will be judged by ret,
> and if s1[i] = '\0', it will be judegd by !s1[i].
> So in reality, s2 [i] will never make a judgment
Sgtm. Out of curiosity, was this tripping a compiler warning? If so,
could you provide the details?
Thanks,
Ian
> Signed-off-by: Feng Yang <yangfeng@...inos.cn>
> ---
> tools/perf/util/bpf_skel/kwork_trace.bpf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/bpf_skel/kwork_trace.bpf.c b/tools/perf/util/bpf_skel/kwork_trace.bpf.c
> index cbd79bc4b330..9ce9c8dddc4b 100644
> --- a/tools/perf/util/bpf_skel/kwork_trace.bpf.c
> +++ b/tools/perf/util/bpf_skel/kwork_trace.bpf.c
> @@ -80,7 +80,7 @@ static __always_inline int local_strncmp(const char *s1,
>
> for (i = 0; i < sz; i++) {
> ret = (unsigned char)s1[i] - (unsigned char)s2[i];
> - if (ret || !s1[i] || !s2[i])
> + if (ret || !s1[i])
> break;
> }
>
> --
> 2.43.0
>
Powered by blists - more mailing lists