Skip to contentSkip to conversation

selftests/bpf: fix bpf_target_sparc check

PATCH Superseded Ilya Leoshkevich 2 participants 3 messages Jul 9, 2019 – Jul 10, 2019

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/bpf: fix bpf_target_sparc check

bpf_helpers.h fails to compile on sparc: the code should be checking for defined(bpf_target_sparc), but checks simply for bpf_target_sparc.

---
 tools/testing/selftests/bpf/bpf_helpers.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/bpf_helpers.h +1 -1
index 5f6f9e7aba2a..a8fea087aa90 100644
@@ -443,7 +443,7 @@ static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode,
 #ifdef bpf_target_powerpc
 #define BPF_KPROBE_READ_RET_IP(ip, ctx)		({ (ip) = (ctx)->link; })
 #define BPF_KRETPROBE_READ_RET_IP		BPF_KPROBE_READ_RET_IP
-#elif bpf_target_sparc
+#elif defined(bpf_target_sparc)
 #define BPF_KPROBE_READ_RET_IP(ip, ctx)		({ (ip) = PT_REGS_RET(ctx); })
 #define BPF_KRETPROBE_READ_RET_IP		BPF_KPROBE_READ_RET_IP
 #else
Signature · 1 line
2.21.0
#1 lore raw
Quoted 14 lines · Ilya Leoshkevich

bpf_helpers.h fails to compile on sparc: the code should be checking for defined(bpf_target_sparc), but checks simply for bpf_target_sparc.

---
 tools/testing/selftests/bpf/bpf_helpers.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/bpf_helpers.h +0 -0
index 5f6f9e7aba2a..a8fea087aa90 100644

tools/testing/selftests/bpf/bpf_helpers.h static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode, · line 443

Quoted 1 line
tools/testing/selftests/bpf/bpf_helpers.h +0 -0
@@ -443,7 +443,7 @@ static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode,
 #ifdef bpf_target_powerpc

While at it, can you please also fix this one?

Quoted 10 lines
tools/testing/selftests/bpf/bpf_helpers.h +1 -2
 #define BPF_KPROBE_READ_RET_IP(ip, ctx)                ({ (ip) = (ctx)->link; })
 #define BPF_KRETPROBE_READ_RET_IP              BPF_KPROBE_READ_RET_IP
-#elif bpf_target_sparc
+#elif defined(bpf_target_sparc)
 #define BPF_KPROBE_READ_RET_IP(ip, ctx)                ({ (ip) = PT_REGS_RET(ctx); })
 #define BPF_KRETPROBE_READ_RET_IP              BPF_KPROBE_READ_RET_IP
 #else
--

2.21.0

#2 lore raw
Quoted 12 lines

Am 09.07.2019 um 19:56 schrieb Andrii Nakryiko <[email protected]>:

Quoted 9 lines · Ilya Leoshkevich

bpf_helpers.h fails to compile on sparc: the code should be checking for defined(bpf_target_sparc), but checks simply for bpf_target_sparc.

---
tools/testing/selftests/bpf/bpf_helpers.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines

tools/testing/selftests/bpf/bpf_helpers.h static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode, · line 443

Quoted 6 lines
tools/testing/selftests/bpf/bpf_helpers.h +0 -0
index 5f6f9e7aba2a..a8fea087aa90 100644
@@ -443,7 +443,7 @@ static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode,
 #ifdef bpf_target_powerpc

While at it, can you please also fix this one?

Do you mean #ifdef bpf_target_powerpc? I think it’s correct, because it’s #ifdef, not #if. But I could change it to #if defined() for consistency.

Best regards,
Ilya