Received: by 10.213.65.68 with SMTP id h4csp554240imn; Tue, 13 Mar 2018 12:52:17 -0700 (PDT) X-Google-Smtp-Source: AG47ELvxEEYEeX+lIpJRQzMt+ep1jmYt9610RAMP9ebrB3u3W0n/Y31BCgO6veRwH68pARvv13bE X-Received: by 10.99.124.92 with SMTP id l28mr1424092pgn.51.1520970737875; Tue, 13 Mar 2018 12:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520970737; cv=none; d=google.com; s=arc-20160816; b=rXlP/cEIZttqF/bF8E2XeRZzOeluNVCpR1TiZ/MaC1RjR/CiAV2GDYAOL2CMjYRpUS qjsaWixS7MgDpXEQfLkqkNE//8IpNmpVZvBI1i2Eh+9MW/Bnr70oETsQUaGnaC4IagSz M8EEZZQDIFKq8HPrdRRlDM41GuKwi1O2DpCIbKkEYv/qqM9dhh1yKwtqROrQs8dBxqn+ BIG2qAUMIr0doJkt51CJabbGiHrCSRIyQ89t/lt1mfwUlraaE3ipTl5yWhBP02tyKHBY 4QCwVktUqPaJNL23aN1rzBlfAySjFtv+Z3oT6jd7WMI2SX5Uem8Be3wf0PiHV9rVrFgB +3+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=kAZx9DFIAm0eV3zHFogGRnY2Cp5kqjv02JdW5cXaKok=; b=loDOqxNKrYgJwmqCp9uxq0rI/ho3iWp7kSeL0JtbMQQeXM2xHjWgRwdYFEFhQsxhgn 29o3pV98IkTjjB+kK0331Y8ezbaTdryhu+T9Okxf0tpOR7G4Gac49S8mhh9ROKMpJl3G 54pZvozhFmwJ7DcdXBlpmCaHufRQQDcorucp8fPaaNhfFZq4g8MG0blCIU8hYXPLUUWh PU6mfsvJLjGMaMx167LHZcDyQ7gPNocPQrlcsKhlHXIA2iPmewuDdYpr688bF2D3HEK8 EsfD+dumq6DlFvDmO1NjsWcYR6lAq33/jNEK3OM/4L27dep74i15XdhFeLWuAcNcU1wz NhAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HTGsgeG0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u11si629830pfh.197.2018.03.13.12.52.03; Tue, 13 Mar 2018 12:52:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HTGsgeG0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752800AbeCMTu5 (ORCPT + 99 others); Tue, 13 Mar 2018 15:50:57 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35390 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752740AbeCMTuz (ORCPT ); Tue, 13 Mar 2018 15:50:55 -0400 Received: by mail-wm0-f68.google.com with SMTP id x7so140257wmc.0; Tue, 13 Mar 2018 12:50:54 -0700 (PDT) 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=kjuX0PvF8ijTW1oaeZSAhrh1CSah+0c4HnO4B9PJNzFXfSswxGiwsqSH1a0k5ZB+4h ngLU4FUxO5BljSIhSBigtE5Ul/mLtHhB0cKjpaXUVQCakKEjKCiID04JCpJPakTNS++N FU9xX6RhgI+6AP/nESfq5tTmEsSRbLZ54zLm2N07AVtQ3kL5zXKbuIYs4k6bDmY5Z99g 9Ts0A/o1ZDkIjZ1m/DtCZlgDk3F3O7z6rBoEqy5O8kd63Mf/qdEyCzOvTOltDa6FUBXM TvRkYeU5v//Ladx6hEHChtqEt9NkzPL3qnGw2hBUubFLbrhX4L/AQW++I9WDd/2tQuph iF/g== X-Gm-Message-State: AElRT7GEITCQ1aEUTevQjEzXcnV8nyae7km5acPjrU1CSzx8sFA57AzO M6Jr2MGXpFqfv/YqcHJmjVohV31+YLA= X-Received: by 10.28.141.4 with SMTP id p4mr1802393wmd.59.1520970653565; Tue, 13 Mar 2018 12:50:53 -0700 (PDT) Received: from localhost ([37.176.236.47]) by smtp.gmail.com with ESMTPSA id x7sm1173546wrd.76.2018.03.13.12.50.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */ -- 1.9.1