[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241117080446.182201-1-guanjing@cmss.chinamobile.com>
Date: Sun, 17 Nov 2024 16:04:46 +0800
From: guanjing <guanjing@...s.chinamobile.com>
To: peterz@...radead.org,
mingo@...hat.com,
acme@...nel.org,
namhyung@...nel.org,
mark.rutland@....com,
alexander.shishkin@...ux.intel.com,
jolsa@...nel.org,
irogers@...gle.com,
adrian.hunter@...el.com,
kan.liang@...ux.intel.com,
mpetlan@...hat.com
Cc: linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org,
guanjing <guanjing@...s.chinamobile.com>
Subject: [PATCH v1] perf tests: Fix unsigned comparison with less than zero
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>
---
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