All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] backports: improve MTU spatch
@ 2017-02-07  9:04 Johannes Berg
  2017-02-10 23:33 ` Steve deRosier
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2017-02-07  9:04 UTC (permalink / raw)
  To: backports; +Cc: Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Improve the MTU spatch to
 1) not handle arbitrary expressions, only constants - the one
    case where I found expressions can't actually just move it
    to a function, it won't compile
 2) if min_mtu isn't set, assume 0

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 patches/0073-netdevice-mtu-range.cocci | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/patches/0073-netdevice-mtu-range.cocci b/patches/0073-netdevice-mtu-range.cocci
index 30276f950e10..d9fb3d7ab3fa 100644
--- a/patches/0073-netdevice-mtu-range.cocci
+++ b/patches/0073-netdevice-mtu-range.cocci
@@ -3,6 +3,32 @@
 
 first_ops = 0
 
+@both@
+expression ndevexp;
+constant e1, e2;
+identifier func;
+position p;
+@@
+func(...) {
+	<+...
+	ndevexp->min_mtu = e1;
+	ndevexp->max_mtu@p = e2;
+	...+>
+}
+
+@@
+expression ndevexp;
+constant MAX;
+identifier func;
+position p != both.p;
+@@
+func(...) {
+	<+...
++	ndevexp->min_mtu = 0;
+	ndevexp->max_mtu@p = MAX;
+	...+>
+}
+
 @r@
 identifier OPS;
 position p;
@@ -32,7 +58,8 @@ if not(first_ops == ln):
   cocci.include_match(False)
 
 @r1 exists@
-expression ndevexp, e1, e2;
+expression ndevexp;
+constant e1, e2;
 identifier func;
 @@
 func(...) {
@@ -45,7 +72,7 @@ func(...) {
 }
 
 @r2@
-expression r1.e1,r1.e2;
+constant r1.e1,r1.e2;
 identifier r.OPS;
 @@
 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH] backports: improve MTU spatch
  2017-02-07  9:04 [PATCH] backports: improve MTU spatch Johannes Berg
@ 2017-02-10 23:33 ` Steve deRosier
  0 siblings, 0 replies; 2+ messages in thread
From: Steve deRosier @ 2017-02-10 23:33 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports, Johannes Berg

On Tue, Feb 7, 2017 at 1:04 AM, Johannes Berg <johannes@sipsolutions.net> wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> Improve the MTU spatch to
>  1) not handle arbitrary expressions, only constants - the one
>     case where I found expressions can't actually just move it
>     to a function, it won't compile
>  2) if min_mtu isn't set, assume 0
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---

Looks OK to me, though I'm still only starting to get used to coccinelle.

- Steve
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

end of thread, other threads:[~2017-02-10 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07  9:04 [PATCH] backports: improve MTU spatch Johannes Berg
2017-02-10 23:33 ` Steve deRosier

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.