summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorCheng-Yang Chou <yphbchou0911@gmail.com>2026-03-05 03:57:57 +0800
committerTejun Heo <tj@kernel.org>2026-03-04 12:07:43 -1000
commit6944e6d8a6d4c1e654de1da112da8fef1b30e623 (patch)
treef28acc38fc3aa540bdcd9dc467596e63c7d9670e /tools/testing
parent7a8464555d2e5f038758bb19e72ab4710b79e9cd (diff)
sched_ext/selftests: Fix format specifier and buffer length in file_write_long()
Use %ld (not %lu) for signed long, and pass the actual string length returned by sprintf() to write_text() instead of sizeof(buf). Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/sched_ext/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/sched_ext/util.c b/tools/testing/selftests/sched_ext/util.c
index e47769c91918..2111329ed289 100644
--- a/tools/testing/selftests/sched_ext/util.c
+++ b/tools/testing/selftests/sched_ext/util.c
@@ -60,11 +60,11 @@ int file_write_long(const char *path, long val)
char buf[64];
int ret;
- ret = sprintf(buf, "%lu", val);
+ ret = sprintf(buf, "%ld", val);
if (ret < 0)
return ret;
- if (write_text(path, buf, sizeof(buf)) <= 0)
+ if (write_text(path, buf, ret) <= 0)
return -1;
return 0;