public inbox for sched-ext@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] tools/sched_ext: Fix get_prandom_u64() prototype
@ 2026-03-08 13:06 Cheng-Yang Chou
  2026-03-08 14:01 ` Andrea Righi
  0 siblings, 1 reply; 3+ messages in thread
From: Cheng-Yang Chou @ 2026-03-08 13:06 UTC (permalink / raw)
  To: sched-ext; +Cc: tj, void, arighi, changwoo, jserv, yphbchou0911

In C99 (Sec 6.7.5.3), an empty parameter list in a declaration leaves
the parameter types unspecified (K&R style), not explicitly zero.
Consequently, the compiler would silently accept arbitrary arguments
passed to the function.

Declare the function with (void) to form a proper prototype asserting
it takes no arguments.

Signed-off-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
---
 tools/sched_ext/include/scx/common.bpf.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/sched_ext/include/scx/common.bpf.h b/tools/sched_ext/include/scx/common.bpf.h
index a63a98a96b86..99b1a94097e7 100644
--- a/tools/sched_ext/include/scx/common.bpf.h
+++ b/tools/sched_ext/include/scx/common.bpf.h
@@ -621,7 +621,6 @@ static inline bool time_in_range_open(u64 a, u64 b, u64 c)
 	return time_after_eq(a, b) && time_before(a, c);
 }
 
-
 /*
  * Other helpers
  */
@@ -870,11 +869,10 @@ static inline u64 scale_by_task_weight_inverse(const struct task_struct *p, u64
 	return value * 100 / p->scx.weight;
 }
 
-
 /*
  * Get a random u64 from the kernel's pseudo-random generator.
  */
-static inline u64 get_prandom_u64()
+static inline u64 get_prandom_u64(void)
 {
 	return ((u64)bpf_get_prandom_u32() << 32) | bpf_get_prandom_u32();
 }
-- 
2.48.1


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

end of thread, other threads:[~2026-03-08 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-08 13:06 [PATCH] tools/sched_ext: Fix get_prandom_u64() prototype Cheng-Yang Chou
2026-03-08 14:01 ` Andrea Righi
2026-03-08 14:41   ` Cheng-Yang Chou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox