Received: by 10.192.165.148 with SMTP id m20csp1288567imm; Sat, 5 May 2018 08:40:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZra2Jlmn/1oMdwBW8XeCcuOLr/cKSpPypmXmjJ6ydXDK+Xap6a+wZrhLgJtHYZed5FzT/FW X-Received: by 10.98.152.203 with SMTP id d72mr30785053pfk.98.1525534807541; Sat, 05 May 2018 08:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525534807; cv=none; d=google.com; s=arc-20160816; b=lopZv6zWIGbXmpn0OF9ZO9FqLcX/zcP+zbsWz3BJ+N+uxNpyziqrILoL8YmsUR+Y+L GLkPvHu0e+OXrTHSLSihqQHDKwYG4OVq8fLWadYdONBs/eenaF2ogd6sEw4DGf0zIMg0 1nH/v8wUJbHP8RoFqLj0uZuu8jSNeTogTYL5O6rwdslAYE2yuRs9s8FTZO2E3cOX5oLf 8qc+SgEvCY2R9f4jk9mZErroMnu3eec7556p3FIAxFBNxdo5p4qZp9/RsBOeOQPfV4dc j6Zmdkmn2dhXSjHiHFzkHIt+EE5T+FjUOkXsYpE6pKnNjMsOHKSd/gzlnBIHP6uu7nrR RUFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=fSeQhtOTOdIc2wF3kF5t8KgjybOwR6Hp7EfPnTo7ikU=; b=wDxjL1iqu3ngwnwMGZMJT0rwhy/Du7vA7b7oQR2X+petC7Kd4NEQ8y9B/q0rSlRMei x/rgqubSD2Io7aIgBAZphqie4Ta97fyCmVDpqwFva2Qa38teoYF4sYz5OZCbW3PwzuoJ 519W/YL4YYzdqLSGiERBzxjn4IXuFMgcBb6qioDbdmAfnfQmBMj5aGZr0YOyh6YVpeAn E5WYkAvwSmL16QtL8/Gy9yAYhM8JqeMEoFfEVPQDi2CNrurUNNc6nDVtmRALqZ/nG3NE G/yqejn3JNEsWOvhB9NWs0L+5LPsgmzrn9xq6cBdGghbis9DpwSPTQEAuCkKNsdOPZ8s grqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=We58WLaL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b19-v6si18349362pls.482.2018.05.05.08.39.53; Sat, 05 May 2018 08:40:07 -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=@lunn.ch header.s=20171124 header.b=We58WLaL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751793AbeEEPj3 (ORCPT + 99 others); Sat, 5 May 2018 11:39:29 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:50208 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbeEEPj0 (ORCPT ); Sat, 5 May 2018 11:39:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=fSeQhtOTOdIc2wF3kF5t8KgjybOwR6Hp7EfPnTo7ikU=; b=We58WLaLM2JI4fSgwc4tohexvFb4BgU9i4hVslLozsMEXXN5VZzIlLUWqIcnEjKxXGlavPr385CE4blhM8ua6Cq+3HtxmKFjfQYrhO8BUaAo8/LjWyX8bTEqbO8bWeq7eeNHzGgBsUWiyIA772ghNaatolmS8F3BBPKGOwV6Qfg=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1fEzH7-00084h-Og; Sat, 05 May 2018 17:39:05 +0200 Date: Sat, 5 May 2018 17:39:05 +0200 From: Andrew Lunn To: Salvatore Mesoraca Cc: Florian Fainelli , Vivien Didelot , linux-kernel@vger.kernel.org, Kernel Hardening , netdev@vger.kernel.org, "David S. Miller" , Kees Cook Subject: Re: [PATCH] net: dsa: drop some VLAs in switch.c Message-ID: <20180505153905.GA30439@lunn.ch> References: <1520970647-19587-1-git-send-email-s.mesoraca16@gmail.com> <87fu5321du.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 05, 2018 at 12:36:36PM +0200, Salvatore Mesoraca wrote: > 2018-03-13 21:06 GMT+01:00 Florian Fainelli : > > On 03/13/2018 12:58 PM, Vivien Didelot wrote: > >> Hi Salvatore, > >> > >> Salvatore Mesoraca writes: > >> > >>> 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 > >> > >> NAK. > >> > >> We are in the process to remove hardcoded limits such as DSA_MAX_PORTS > >> and DSA_MAX_SWITCHES, so we have to stick with ds->num_ports. > > > > Then this means that we need to allocate a bitmap from the heap, which > > sounds a bit superfluous and could theoretically fail... not sure which > > way is better, but bumping the size to DSA_MAX_PORTS definitively does > > help people working on enabling -Wvla. > > Hi Florian, > > Should I consider this patch still NAKed or not? > Should I resend the patch with some modifications? Hi Salvatore We have been removing all uses of DSA_MAX_PORTS. I don't particularly like arbitrary limits on how many ports a switch can have, or how many switches a board can have. So i would prefer to not use DSA_MAX_PORTS here. You could make the bitmap part of the dsa_switch structure. This is allocated by dsa_switch_alloc() and is passed the number of ports. Doing the allocation there means you don't need to worry about it failing in dsa_switch_mdb_add() or dsa_switch_vlan_add(). Andrew