]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
perf tests: Fix an incorrect type in append_script()
authorJiapeng Chong <jiapeng.chong@linux.alibaba.com>
Fri, 15 Nov 2024 09:15:27 +0000 (17:15 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 12 Dec 2024 19:08:36 +0000 (16:08 -0300)
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.

Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=11909
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241115091527.128923-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/tests-scripts.c

index cf3ae0c1d871742be0d8cc616cb2a9223a4009ec..1d5759d08141749d55212edb41097501f0243b40 100644 (file)
@@ -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);