Skip to contentSkip to conversation

selftests/bpf: fix bpf_target_sparc check

PATCH Applied Ilya Leoshkevich 4 participants 4 messages Jul 10, 2019 – Jul 12, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

Also change #ifdef bpf_target_powerpc to #if defined() for consistency.

---

v1->v2: bpf_target_powerpc change

 tools/testing/selftests/bpf/bpf_helpers.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/bpf_helpers.h +2 -2
index 5f6f9e7aba2a..0214797518ce 100644
@@ -440,10 +440,10 @@ static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode,
 
 #endif
 
-#ifdef bpf_target_powerpc
+#if defined(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
Acked-by on v2 1/1
#1 lore raw
Quoted 8 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.

Also change #ifdef bpf_target_powerpc to #if defined() for consistency.

---

Thanks!

Quoted 11 lines

v1->v2: bpf_target_powerpc change

 tools/testing/selftests/bpf/bpf_helpers.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/bpf_helpers.h +0 -0
index 5f6f9e7aba2a..0214797518ce 100644

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

Quoted 5 lines
tools/testing/selftests/bpf/bpf_helpers.h +1 -1
@@ -440,10 +440,10 @@ static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode,
 
 #endif
 
-#ifdef bpf_target_powerpc
+#if defined(bpf_target_powerpc)

Oh, yeah, that mix of #ifdef and #if definitely threw me off. I prefer consistency, so thanks for this update!

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

maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Ilya Leoshkevich

From: Ilya Leoshkevich <[email protected]>
Date: Wed, 10 Jul 2019 13:56:54 +0200

Quoted 6 lines

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.

Also change #ifdef bpf_target_powerpc to #if defined() for consistency.