All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] perf tests: Fix an incorrect type in append_script()
@ 2024-11-15  9:15 Jiapeng Chong
  2024-11-15 18:57 ` Ian Rogers
  0 siblings, 1 reply; 3+ messages in thread
From: Jiapeng Chong @ 2024-11-15  9:15 UTC (permalink / raw)
  To: peterz
  Cc: mingo, acme, namhyung, mark.rutland, alexander.shishkin, jolsa,
	irogers, adrian.hunter, kan.liang, linux-perf-users, linux-kernel,
	Jiapeng Chong, Abaci Robot

The return value from the call to readlink() is ssize_t. However, the
return value is being assigned to an size_t variable 'len', so making
'len' an ssize_t.

./tools/perf/tests/tests-scripts.c:182:5-8: WARNING: Unsigned expression compared with zero: len < 0.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11909
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 tools/perf/tests/tests-scripts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/tests-scripts.c b/tools/perf/tests/tests-scripts.c
index cf3ae0c1d871..1d5759d08141 100644
--- a/tools/perf/tests/tests-scripts.c
+++ b/tools/perf/tests/tests-scripts.c
@@ -174,7 +174,7 @@ static void append_script(int dir_fd, const char *name, char *desc,
 	char filename[PATH_MAX], link[128];
 	struct test_suite *test_suite, **result_tmp;
 	struct test_case *tests;
-	size_t len;
+	ssize_t len;
 	char *exclusive;
 
 	snprintf(link, sizeof(link), "/proc/%d/fd/%d", getpid(), dir_fd);
-- 
2.32.0.3.g01195cf9f


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] perf tests: Fix an incorrect type in append_script()
  2024-11-15  9:15 [PATCH -next] perf tests: Fix an incorrect type in append_script() Jiapeng Chong
@ 2024-11-15 18:57 ` Ian Rogers
  2024-12-12 19:09   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2024-11-15 18:57 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
	jolsa, adrian.hunter, kan.liang, linux-perf-users, linux-kernel,
	Abaci Robot

On Fri, Nov 15, 2024 at 1:15 AM Jiapeng Chong
<jiapeng.chong@linux.alibaba.com> wrote:
>
> The return value from the call to readlink() is ssize_t. However, the
> return value is being assigned to an size_t variable 'len', so making
> 'len' an ssize_t.
>
> ./tools/perf/tests/tests-scripts.c:182:5-8: WARNING: Unsigned expression compared with zero: len < 0.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11909
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/tests/tests-scripts.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/tests-scripts.c b/tools/perf/tests/tests-scripts.c
> index cf3ae0c1d871..1d5759d08141 100644
> --- a/tools/perf/tests/tests-scripts.c
> +++ b/tools/perf/tests/tests-scripts.c
> @@ -174,7 +174,7 @@ static void append_script(int dir_fd, const char *name, char *desc,
>         char filename[PATH_MAX], link[128];
>         struct test_suite *test_suite, **result_tmp;
>         struct test_case *tests;
> -       size_t len;
> +       ssize_t len;
>         char *exclusive;
>
>         snprintf(link, sizeof(link), "/proc/%d/fd/%d", getpid(), dir_fd);
> --
> 2.32.0.3.g01195cf9f
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] perf tests: Fix an incorrect type in append_script()
  2024-11-15 18:57 ` Ian Rogers
@ 2024-12-12 19:09   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-12-12 19:09 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Jiapeng Chong, peterz, mingo, namhyung, mark.rutland,
	alexander.shishkin, jolsa, adrian.hunter, kan.liang,
	linux-perf-users, linux-kernel, Abaci Robot

On Fri, Nov 15, 2024 at 10:57:59AM -0800, Ian Rogers wrote:
> On Fri, Nov 15, 2024 at 1:15 AM Jiapeng Chong
> <jiapeng.chong@linux.alibaba.com> wrote:
> >
> > The return value from the call to readlink() is ssize_t. However, the
> > return value is being assigned to an size_t variable 'len', so making
> > 'len' an ssize_t.
> >
> > ./tools/perf/tests/tests-scripts.c:182:5-8: WARNING: Unsigned expression compared with zero: len < 0.
> >
> > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11909
> > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>

Thanks, applied to perf-tools-next,

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-12 19:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-15  9:15 [PATCH -next] perf tests: Fix an incorrect type in append_script() Jiapeng Chong
2024-11-15 18:57 ` Ian Rogers
2024-12-12 19:09   ` Arnaldo Carvalho de Melo

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.