lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 28 Jul 2020 11:08:45 -0700
From:   Joe Perches <joe@...ches.com>
To:     Tom Parkin <tparkin@...alix.com>, netdev@...r.kernel.org
Subject: Re: [PATCH 17/29] l2tp: avoid precidence issues in L2TP_SKB_CB macro

On Tue, 2020-07-28 at 09:21 -0700, Joe Perches wrote:
> On Tue, 2020-07-21 at 18:32 +0100, Tom Parkin wrote:
> > checkpatch warned about the L2TP_SKB_CB macro's use of its argument: add
> > braces to avoid the problem.
> []
> > diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
> []
> > @@ -93,7 +93,7 @@ struct l2tp_skb_cb {
> >  	unsigned long		expires;
> >  };
> >  
> > -#define L2TP_SKB_CB(skb)	((struct l2tp_skb_cb *)&skb->cb[sizeof(struct inet_skb_parm)])
> > +#define L2TP_SKB_CB(skb)	((struct l2tp_skb_cb *)&(skb)->cb[sizeof(struct inet_skb_parm)])
> 
> Likely better to use a static inline.
> 
> Something like:
> 
> static inline struct l2tp_skb_cb *L2TP_SKB_SB(struct sk_buff *skb)
> {
> 	return &skb->cb[sizeof(struct inet+skb_parm)];
> }

More precisely:
---
 net/l2tp/l2tp_core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index e723828e458b..78ad6d8405c4 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -93,7 +93,10 @@ struct l2tp_skb_cb {
 	unsigned long		expires;
 };
 
-#define L2TP_SKB_CB(skb)	((struct l2tp_skb_cb *)&(skb)->cb[sizeof(struct inet_skb_parm)])
+static inline struct l2tp_skb_cb *L2TP_SKB_CB(struct sk_buff *skb)
+{
+	return (struct l2tp_skb_cb *)&skb->cb[sizeof(struct inet_skb_parm)];
+}
 
 static struct workqueue_struct *l2tp_wq;
 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ