All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched_ext/selftests: Fix format specifier and buffer length in file_write_long()
@ 2026-03-04 19:57 Cheng-Yang Chou
  2026-03-04 22:09 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Cheng-Yang Chou @ 2026-03-04 19:57 UTC (permalink / raw)
  To: sched-ext; +Cc: tj, void, arighi, changwoo, jserv, yphbchou0911

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>
---
 tools/testing/selftests/sched_ext/util.c | 4 ++--
 1 file 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;
-- 
2.48.1


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

* Re: [PATCH] sched_ext/selftests: Fix format specifier and buffer length in file_write_long()
  2026-03-04 19:57 [PATCH] sched_ext/selftests: Fix format specifier and buffer length in file_write_long() Cheng-Yang Chou
@ 2026-03-04 22:09 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2026-03-04 22:09 UTC (permalink / raw)
  To: Cheng-Yang Chou
  Cc: sched-ext, void, arighi, changwoo, jserv, Emil Tsalapatis,
	linux-kernel

Hello,

Applied to sched_ext/for-7.0-fixes.

Thanks.

--
tejun

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

end of thread, other threads:[~2026-03-04 22:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 19:57 [PATCH] sched_ext/selftests: Fix format specifier and buffer length in file_write_long() Cheng-Yang Chou
2026-03-04 22:09 ` Tejun Heo

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.