Received: by 10.192.165.148 with SMTP id m20csp1411213imm; Sat, 5 May 2018 11:23:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrxDMiLYErxOQfC0hmvp+Rdw6sfGLc2DdW4Mx6vejWpW5UEuETX1c26nGK80GZ7+jFt/O/O X-Received: by 2002:a63:6d8a:: with SMTP id i132-v6mr26345368pgc.314.1525544601327; Sat, 05 May 2018 11:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525544601; cv=none; d=google.com; s=arc-20160816; b=VVr8kZBDGN1DP2oBtgCOyTp9L2XyeuwGz4labZobdWYlwkKveB69AM/r+fCjoaOI9/ cjXpjGDfQMGE+zBunCaqIg7KSGUwvZQTzeDY8Sw2HR+deVpjhJbNlPy462untFtVQNG1 o1Lh4bz3EegVw2YmkAvERRVCjdxdYaxed+o3qqgJLID2m/Yfiw6Md04FAbVrUJ7ssVUU a430yfRDRt4eKSV0RS/lwtGMDADoqJ9btXEdSt+3JBQ40bZvaMhh+88/xw8A2DI4Z0RM Q3/Zj/F61oLiOatKZQZh6mej5OCEBA/aS8j7FjSaJsR+c+lMpDQ8TwVtLfgeWmH+jKMz ra2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=S64+5UISbcQpFT1e4a2+SrX8iZVSo22CjhCPe1KMOWo=; b=ebHgUOW6xqFfZODKI6MatSwimqqO2yIgHiOkBdsMedMIQYFTa/Q8gH3nB3I26qddA2 8imds6WlKi15jUCDv8wGUSZpQ+komvBpI73Mn69GhlKaTU7D86xJGrkfZdnfZov/GrSo zlFaLWvHsVV7tE/CG0mnQvAY5EhRw9rgYdLWk/4PI7LJ6k98Q1qrrjThZZXA/+gJtaNE oKpPTIJyEeN8b3ug8OteqTI0RWdrnLSEwU+6amlFEzacwZM671QYtssN2FgIMUm58bnY byGzPoMci+8yK2b/kdzOXbY/Z+nszVBTk1hwMgCUArUMOEUGhs5RP2eDR8sYkaKEZYry W9Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=S20BT5vg; dkim=fail header.i=@chromium.org header.s=google header.b=bVhUPcO7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v24si18983190pfj.292.2018.05.05.11.23.06; Sat, 05 May 2018 11:23:21 -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=fail header.i=@google.com header.s=20161025 header.b=S20BT5vg; dkim=fail header.i=@chromium.org header.s=google header.b=bVhUPcO7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751829AbeEESWY (ORCPT + 99 others); Sat, 5 May 2018 14:22:24 -0400 Received: from mail-ua0-f193.google.com ([209.85.217.193]:38057 "EHLO mail-ua0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751795AbeEESWV (ORCPT ); Sat, 5 May 2018 14:22:21 -0400 Received: by mail-ua0-f193.google.com with SMTP id y8so16048545ual.5 for ; Sat, 05 May 2018 11:22:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=S64+5UISbcQpFT1e4a2+SrX8iZVSo22CjhCPe1KMOWo=; b=S20BT5vgSIJloC3tZ14Mk3uiY5hUdOj+XdTgyhQsG3t5taQSU3XLrRKRTHmyp1P+0D gqEuV98OaDPy0L3VpN76vs9tfZ5HlgKOS2Q1d3wlzVDGNML0oKSiGWLaJfALklYtLf7H YszBaJzC5yPXp2pPLtpw6OGll3+tkcrLIUxRXziUDM7fDjgyxjg/EfcoxNq6GdW6m+9i 1pu5sH5e+8YlxKPy0+orKd4bYPZw61+j+XjRa6TTnyUcS4QJeg+SLbRhDsjNHWRDIdjL nMOOgbB/0Qt+OoeKzhHZIvzrFXx+UZyHwfZEtd6y8Qy5cNJfmHDdYYEypUytiMERM4BC 1kyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=S64+5UISbcQpFT1e4a2+SrX8iZVSo22CjhCPe1KMOWo=; b=bVhUPcO7163u1CsfR6+VJSbRabm5RmI7K9tXixaoCYHjfz2XRa69i8gF6fDOjTIHqq B1ub5SOd9yotHc/2kquWu309C2KtS1ZZaFOOrZ9EJ2S7+1nD1e03XuFQjHn7Fe/97AXt j+x1bdsRlm1u+iRQa3SBICkOjcn74CnAkzRkw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=S64+5UISbcQpFT1e4a2+SrX8iZVSo22CjhCPe1KMOWo=; b=j2Av/1COwH8CSfzwb11wSy0NYYRz6ut8de1QHT6dEbXSGLrabwYu6oXFZtzMa7jaDd oQRfaAdLpueYo0djjQzeAzglCBI7qYSZesNqnXzhbVK7kzKH0GyLpFbppazfXsDtO5FP LCC9AaQ8fJCClInQE28f4wv3NrVbnFn38dWoGSvF9OFHsWdbGDtUdOGrRzJO4jJJXnSE n/yBjReuxjIYkQasZJCVRsSXr6QhEaOh6R5icEMxd05E68DIMGpseTKdBagW/zix6xc5 ASkNwdyHlTwRa4G7nEKlmnyP7G/Kv8X22n9NtDxPWhvanSsIXpQoxFYslGRUF8G7XN69 JdeQ== X-Gm-Message-State: ALQs6tA1yqfOQ+odvAZEFAOwy/uMwsdIUZZ8NNAlaZHQLZKJ0Uj1wIDI k8gyMYVwcvlAbdAdBiozcQHJxAfEDdIjZkh8Pu5yMA== X-Received: by 10.176.37.8 with SMTP id j8mr27793941uan.83.1525544540668; Sat, 05 May 2018 11:22:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.11.209 with HTTP; Sat, 5 May 2018 11:22:20 -0700 (PDT) In-Reply-To: <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> <20180505153905.GA30439@lunn.ch> From: Kees Cook Date: Sat, 5 May 2018 11:22:20 -0700 X-Google-Sender-Auth: 8tCujQ65m3yvsB4hcZJOKo3dFIE Message-ID: Subject: Re: [PATCH] net: dsa: drop some VLAs in switch.c To: Andrew Lunn Cc: Salvatore Mesoraca , Florian Fainelli , Vivien Didelot , LKML , Kernel Hardening , Network Development , "David S. Miller" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 5, 2018 at 8:39 AM, Andrew Lunn wrote: > 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(). Are dsa_switch_mdb_add() and dsa_switch_vlan_add() guaranteed to be single-threaded? -Kees -- Kees Cook Pixel Security