All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 2/5] s390/bpf: Fix multiple macro expansions
@ 2015-07-29  8:45 Michael Holzheu
  2015-07-29 18:31 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Holzheu @ 2015-07-29  8:45 UTC (permalink / raw)
  To: David Miller
  Cc: Alexei Starovoitov, Martin Schwidefsky, Daniel Borkmann,
	Joe Perches, netdev, linux-s390

The EMIT6_DISP_LH macro passes the "disp" parameter to the _EMIT6_DISP_LH
macro. The _EMIT6_DISP_LH macro uses the "disp" parameter twice:

 unsigned int __disp_h = ((u32)disp) & 0xff000;
 unsigned int __disp_l = ((u32)disp) & 0x00fff;

The EMIT6_DISP_LH is used several times with EMIT_CONST_U64() as "disp"
parameter. Therefore always two constants are created per usage of
EMIT6_DISP_LH.

Fix this and add variable "_disp" to avoid multiple expansions.

* v2: Move "_disp" to _EMIT6_DISP_LH as suggested by Joe Perches

Fixes: 054623105728 ("s390/bpf: Add s390x eBPF JIT compiler backend")
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
---
 arch/s390/net/bpf_jit_comp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 01ad166..66926ab 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -214,8 +214,9 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 b1)
 
 #define _EMIT6_DISP_LH(op1, op2, disp)				\
 ({								\
-	unsigned int __disp_h = ((u32)disp) & 0xff000;		\
-	unsigned int __disp_l = ((u32)disp) & 0x00fff;		\
+	u32 _disp = (u32) disp;					\
+	unsigned int __disp_h = _disp & 0xff000;		\
+	unsigned int __disp_l = _disp & 0x00fff;		\
 	_EMIT6(op1 | __disp_l, op2 | __disp_h >> 4);		\
 })
 
-- 
2.3.8

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

* Re: [PATCH net-next v2 2/5] s390/bpf: Fix multiple macro expansions
  2015-07-29  8:45 [PATCH net-next v2 2/5] s390/bpf: Fix multiple macro expansions Michael Holzheu
@ 2015-07-29 18:31 ` David Miller
  2015-07-29 19:09   ` Michael Holzheu
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2015-07-29 18:31 UTC (permalink / raw)
  To: holzheu; +Cc: ast, schwidefsky, daniel, joe, netdev, linux-s390


Please, when updating patches in a series, always resubmit the entire
series not just the patches you want to change.

Thank you.

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

* Re: [PATCH net-next v2 2/5] s390/bpf: Fix multiple macro expansions
  2015-07-29 18:31 ` David Miller
@ 2015-07-29 19:09   ` Michael Holzheu
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Holzheu @ 2015-07-29 19:09 UTC (permalink / raw)
  To: David Miller; +Cc: ast, schwidefsky, daniel, joe, netdev, linux-s390

On Wed, 29 Jul 2015 11:31:25 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> 
> Please, when updating patches in a series, always resubmit the entire
> series not just the patches you want to change.
> 
> Thank you.

Sure, I will do that.

Sorry for the trouble!
Michael

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

* [PATCH net-next v2 2/5] s390/bpf: Fix multiple macro expansions
  2015-07-29 19:15 [PATCH net-next v2 0/5] s390/bpf: recache skb->data/hlen for skb_vlan_push/pop Michael Holzheu
@ 2015-07-29 19:15 ` Michael Holzheu
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Holzheu @ 2015-07-29 19:15 UTC (permalink / raw)
  To: David Miller
  Cc: Alexei Starovoitov, Martin Schwidefsky, Daniel Borkmann,
	Joe Perches, netdev, linux-s390

The EMIT6_DISP_LH macro passes the "disp" parameter to the _EMIT6_DISP_LH
macro. The _EMIT6_DISP_LH macro uses the "disp" parameter twice:

 unsigned int __disp_h = ((u32)disp) & 0xff000;
 unsigned int __disp_l = ((u32)disp) & 0x00fff;

The EMIT6_DISP_LH is used several times with EMIT_CONST_U64() as "disp"
parameter. Therefore always two constants are created per usage of
EMIT6_DISP_LH.

Fix this and add variable "_disp" to avoid multiple expansions.

* v2: Move "_disp" to _EMIT6_DISP_LH as suggested by Joe Perches

Fixes: 054623105728 ("s390/bpf: Add s390x eBPF JIT compiler backend")
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
---
 arch/s390/net/bpf_jit_comp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 01ad166..66926ab 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -214,8 +214,9 @@ static inline void reg_set_seen(struct bpf_jit *jit, u32 b1)
 
 #define _EMIT6_DISP_LH(op1, op2, disp)				\
 ({								\
-	unsigned int __disp_h = ((u32)disp) & 0xff000;		\
-	unsigned int __disp_l = ((u32)disp) & 0x00fff;		\
+	u32 _disp = (u32) disp;					\
+	unsigned int __disp_h = _disp & 0xff000;		\
+	unsigned int __disp_l = _disp & 0x00fff;		\
 	_EMIT6(op1 | __disp_l, op2 | __disp_h >> 4);		\
 })
 
-- 
2.3.8

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

end of thread, other threads:[~2015-07-29 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29  8:45 [PATCH net-next v2 2/5] s390/bpf: Fix multiple macro expansions Michael Holzheu
2015-07-29 18:31 ` David Miller
2015-07-29 19:09   ` Michael Holzheu
2015-07-29 19:15 [PATCH net-next v2 0/5] s390/bpf: recache skb->data/hlen for skb_vlan_push/pop Michael Holzheu
2015-07-29 19:15 ` [PATCH net-next v2 2/5] s390/bpf: Fix multiple macro expansions Michael Holzheu

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.