[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fW-e=YPgVMYGY_8cV9-+L83dEx_s1asoAoz62bX=kEfVw@mail.gmail.com>
Date: Tue, 19 Nov 2024 15:16:30 -0800
From: Ian Rogers <irogers@...gle.com>
To: guanjing <guanjing@...s.chinamobile.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,
mpetlan@...hat.com, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] perf tests: Fix unsigned comparison with less than zero
On Mon, Nov 18, 2024 at 11:24 PM guanjing <guanjing@...s.chinamobile.com> wrote:
>
> The return value from the call to readlink() is not unsigned.
> However, the return value is being assigned to an size_t
> variable 'len', so making 'len' an ssize_t.
>
> Eliminate the following coccicheck warning:
>
> tools/perf/tests/tests-scripts.c:181:5-8: WARNING:
> Unsigned expression compared with zero: len < 0
>
> Fixes: 964461ee370f ("perf tests: Run time generate shell test suites")
> Signed-off-by: guanjing <guanjing@...s.chinamobile.com>
Thanks, there is already an outstanding fix for this:
https://lore.kernel.org/lkml/20241115091527.128923-1-jiapeng.chong@linux.alibaba.com/
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.33.0
>
>
>
>
Powered by blists - more mailing lists