* [PATCH] perf kwork: Remove unreachable judgments
@ 2025-03-14 3:10 Feng Yang
2025-03-17 15:44 ` Ian Rogers
2025-03-19 20:13 ` Namhyung Kim
0 siblings, 2 replies; 5+ messages in thread
From: Feng Yang @ 2025-03-14 3:10 UTC (permalink / raw)
To: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, kan.liang
Cc: linux-perf-users, linux-kernel
From: Feng Yang <yangfeng@kylinos.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
Signed-off-by: Feng Yang <yangfeng@kylinos.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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] perf kwork: Remove unreachable judgments
2025-03-14 3:10 [PATCH] perf kwork: Remove unreachable judgments Feng Yang
@ 2025-03-17 15:44 ` Ian Rogers
2025-03-18 2:17 ` Feng Yang
2025-03-19 20:13 ` Namhyung Kim
1 sibling, 1 reply; 5+ messages in thread
From: Ian Rogers @ 2025-03-17 15:44 UTC (permalink / raw)
To: Feng Yang
Cc: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, adrian.hunter, kan.liang, linux-perf-users, linux-kernel
On Thu, Mar 13, 2025 at 8:10 PM Feng Yang <yangfeng59949@163.com> wrote:
>
> From: Feng Yang <yangfeng@kylinos.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@kylinos.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
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] perf kwork: Remove unreachable judgments
2025-03-17 15:44 ` Ian Rogers
@ 2025-03-18 2:17 ` Feng Yang
2025-03-18 15:44 ` Ian Rogers
0 siblings, 1 reply; 5+ messages in thread
From: Feng Yang @ 2025-03-18 2:17 UTC (permalink / raw)
To: irogers
Cc: acme, adrian.hunter, alexander.shishkin, jolsa, kan.liang,
linux-kernel, linux-perf-users, mark.rutland, mingo, namhyung,
peterz, yangfeng59949
On Mon, 17 Mar 2025 08:44:45 -0700 Ian Rogers <irogers@google.com> wrote:
>
> On Thu, Mar 13, 2025 at 8:10 PM Feng Yang <yangfeng59949@163.com> wrote:
> >
> > From: Feng Yang <yangfeng@kylinos.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
There was no warning during compilation,
I just accidentally discovered it while testing and analyzing this code.
Feng
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf kwork: Remove unreachable judgments
2025-03-18 2:17 ` Feng Yang
@ 2025-03-18 15:44 ` Ian Rogers
0 siblings, 0 replies; 5+ messages in thread
From: Ian Rogers @ 2025-03-18 15:44 UTC (permalink / raw)
To: Feng Yang
Cc: acme, adrian.hunter, alexander.shishkin, jolsa, kan.liang,
linux-kernel, linux-perf-users, mark.rutland, mingo, namhyung,
peterz
On Mon, Mar 17, 2025 at 7:17 PM Feng Yang <yangfeng59949@163.com> wrote:
>
> On Mon, 17 Mar 2025 08:44:45 -0700 Ian Rogers <irogers@google.com> wrote:
> >
> > On Thu, Mar 13, 2025 at 8:10 PM Feng Yang <yangfeng59949@163.com> wrote:
> > >
> > > From: Feng Yang <yangfeng@kylinos.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
>
> There was no warning during compilation,
> I just accidentally discovered it while testing and analyzing this code.
Thanks!
Reviewed-by: Ian Rogers <irogers@google.com>
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf kwork: Remove unreachable judgments
2025-03-14 3:10 [PATCH] perf kwork: Remove unreachable judgments Feng Yang
2025-03-17 15:44 ` Ian Rogers
@ 2025-03-19 20:13 ` Namhyung Kim
1 sibling, 0 replies; 5+ messages in thread
From: Namhyung Kim @ 2025-03-19 20:13 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
irogers, adrian.hunter, kan.liang, Feng Yang
Cc: linux-perf-users, linux-kernel
On Fri, 14 Mar 2025 11:10:13 +0800, Feng Yang wrote:
> 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
>
>
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-03-19 20:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-14 3:10 [PATCH] perf kwork: Remove unreachable judgments Feng Yang
2025-03-17 15:44 ` Ian Rogers
2025-03-18 2:17 ` Feng Yang
2025-03-18 15:44 ` Ian Rogers
2025-03-19 20:13 ` Namhyung Kim
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®