From patchwork Tue Mar 13 19:50:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salvatore Mesoraca X-Patchwork-Id: 10280645 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 7818F602C2 for ; Tue, 13 Mar 2018 19:51:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65E112846D for ; Tue, 13 Mar 2018 19:51:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 641F62846F; Tue, 13 Mar 2018 19:51:59 +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=-4.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 31E2F28613 for ; Tue, 13 Mar 2018 19:51:07 +0000 (UTC) Received: (qmail 10096 invoked by uid 550); 13 Mar 2018 19:51:05 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 10058 invoked from network); 13 Mar 2018 19:51:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=kAZx9DFIAm0eV3zHFogGRnY2Cp5kqjv02JdW5cXaKok=; b=HTGsgeG0PSIsK2me/P31r7TXno04clpkvhONagv4RLHHVeUaXZf/2K0q87bKzLvFKw 43ngYP73wrB/eWcqUM6U2YMliwO22qGPYP1V3Zzgz1oXd56WtR/EDD2eOonN9tgY0g1l pBVVNrZgNfN2we8AzLkhlqk974DOG09kvCp1qtyiz9z5GFH9e2d4THeR9RboJJ8RphX3 4C8v7ePiQo3rOm6M13bpTq+xnYu4IDQCDqtfqpWgL+wn4nzuGyiF3nfd+l1q5TXmsstQ gH3nZWGTzbhcQxv0pvSRlpanmSM0eAJLK5hGTromzTf/VWSFqx1A+iKPNnqIZmY/+Onb X9Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kAZx9DFIAm0eV3zHFogGRnY2Cp5kqjv02JdW5cXaKok=; b=eo3uBXlUcnpVhlzjZ846yc2FHtyzSg2/zqEAlWfcAqVO1sl/LxElvToT52LPfHz02W XCwI6SqoqXVdxJNC8XXWB//OQlRt/JAfI63TbrzrJiqPlCVvjEPBGh2rWqrg9d0nvKTN voBzihJBshSdMfbSHsJooPpSPcDx1C7emMMslTUrDBuh0Nt2e00deAFfpfz7I9LD9Aaq +3JrSAqGNHDnBzf7lbAjO+AlSkbL9Nb+iOBSzOPeFqKvVV2vjmhvkcb21dNRkixerAAD wUK5w0HWr5Xn7gip3BEK1ox2n/ipD7/GXYVD8lRoVtaYg5GkdZgNNBDcqatU5ZhbmT82 IrPA== X-Gm-Message-State: AElRT7Eq1TLP21s3Bc/mEKF9Vk6i/2pBCf77W50UV8VgU+LbvHSRRXBl sXoOIqmhvS9IWcNfyvbZk/U= X-Google-Smtp-Source: AG47ELtciVlIFt+kiGm37hplSrnoytbJXUJKxvhTSdZFD19cLPs4gfP1WG+QeiDJDpXess+E1MVovg== X-Received: by 10.28.141.4 with SMTP id p4mr1802393wmd.59.1520970653565; Tue, 13 Mar 2018 12:50:53 -0700 (PDT) From: Salvatore Mesoraca To: linux-kernel@vger.kernel.org Cc: kernel-hardening@lists.openwall.com, netdev@vger.kernel.org, "David S. Miller" , Andrew Lunn , Florian Fainelli , Kees Cook , Salvatore Mesoraca , Vivien Didelot Subject: [PATCH] net: dsa: drop some VLAs in switch.c Date: Tue, 13 Mar 2018 20:50:47 +0100 Message-Id: <1520970647-19587-1-git-send-email-s.mesoraca16@gmail.com> X-Mailer: git-send-email 1.9.1 X-Virus-Scanned: ClamAV using ClamSMTP dsa_switch's num_ports is currently fixed to DSA_MAX_PORTS. So we avoid 2 VLAs[1] by using DSA_MAX_PORTS instead of ds->num_ports. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Salvatore Mesoraca --- net/dsa/switch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/dsa/switch.c b/net/dsa/switch.c index b935117..78e9897 100644 --- a/net/dsa/switch.c +++ b/net/dsa/switch.c @@ -136,7 +136,7 @@ static int dsa_switch_mdb_add(struct dsa_switch *ds, { const struct switchdev_obj_port_mdb *mdb = info->mdb; struct switchdev_trans *trans = info->trans; - DECLARE_BITMAP(group, ds->num_ports); + DECLARE_BITMAP(group, DSA_MAX_PORTS); int port; /* Build a mask of Multicast group members */ @@ -204,7 +204,7 @@ static int dsa_switch_vlan_add(struct dsa_switch *ds, { const struct switchdev_obj_port_vlan *vlan = info->vlan; struct switchdev_trans *trans = info->trans; - DECLARE_BITMAP(members, ds->num_ports); + DECLARE_BITMAP(members, DSA_MAX_PORTS); int port; /* Build a mask of VLAN members */