From patchwork Tue Feb 7 09:04:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 9559557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F2A736047A for ; Tue, 7 Feb 2017 09:04:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE0FF282F5 for ; Tue, 7 Feb 2017 09:04:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2F2528307; Tue, 7 Feb 2017 09:04:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A681C282F5 for ; Tue, 7 Feb 2017 09:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751496AbdBGJEj (ORCPT ); Tue, 7 Feb 2017 04:04:39 -0500 Received: from s3.sipsolutions.net ([5.9.151.49]:54398 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751094AbdBGJEh (ORCPT ); Tue, 7 Feb 2017 04:04:37 -0500 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.88) (envelope-from ) id 1cb1hT-00026g-FX; Tue, 07 Feb 2017 10:04:35 +0100 From: Johannes Berg To: backports@vger.kernel.org Cc: Johannes Berg Subject: [PATCH] backports: improve MTU spatch Date: Tue, 7 Feb 2017 10:04:33 +0100 Message-Id: <20170207090433.22264-1-johannes@sipsolutions.net> X-Mailer: git-send-email 2.9.3 Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Berg 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 --- 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)