Message ID | 20170207090433.22264-1-johannes@sipsolutions.net (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
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
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)