Skip to contentSkip to conversation

selftests/bpf: Fix compiler warnings in task_local_data.h

PATCH Applied Amery Hung 3 participants 3 messages Mar 23 – Mar 24

Subsystems (3)
lore
Share & tools
lore

Amery Hung

author
#0 lore raw

PATCH 1/1 selftests/bpf: Fix compiler warnings in task_local_data.h

Fix compiler warnings about unused parameter, narrowing non-constant into a smaller type and comparison between integers of different size.

---
 tools/testing/selftests/bpf/prog_tests/task_local_data.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/task_local_data.h +3 -2
index 95847088961a..7819f318b2fb 100644
@@ -120,6 +120,7 @@ static void tld_free(void);
 
 static void __tld_thread_exit_handler(void *unused)
 {
+	(void)unused;
 	tld_free();
 }
 #endif
@@ -222,10 +223,10 @@ static tld_key_t __tld_create_key(const char *name, size_t size, bool dyn_data)
 	if (!TLD_READ_ONCE(tld_meta_p)) {
 		err = __tld_init_meta_p();
 		if (err)
-			return (tld_key_t){err};
+			return (tld_key_t){(__s16)err};
 	}
 
-	for (i = 0; i < TLD_MAX_DATA_CNT; i++) {
+	for (i = 0; i < (int)TLD_MAX_DATA_CNT; i++) {
 retry:
 		cnt = atomic_load(&tld_meta_p->cnt);
 		if (i < cnt) {
Signature · 1 line
2.52.0
#2 lore raw
In reply to Amery Hung
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Hello:

This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:

Quoted 7 lines · On Mon, 23 Mar 2026 16:11:33 -0700 you wrote:

Fix compiler warnings about unused parameter, narrowing non-constant into a smaller type and comparison between integers of different size.

---
 tools/testing/selftests/bpf/prog_tests/task_local_data.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Here is the summary with links:
- [bpf-next,v1,1/1] selftests/bpf: Fix compiler warnings in task_local_data.h

    https://git.kernel.org/bpf/bpf-next/c/03b7b389fe88

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html