Received: by 10.213.65.68 with SMTP id h4csp614678imn; Tue, 13 Mar 2018 15:04:47 -0700 (PDT) X-Google-Smtp-Source: AG47ELvI7mI4btuNCwOwD/ATudlOjIGyzxBoFZADpFKhP0ibd1uQE8NWmAwC+rrDyTBpQilGqyRJ X-Received: by 10.99.109.142 with SMTP id i136mr590399pgc.306.1520978687470; Tue, 13 Mar 2018 15:04:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520978687; cv=none; d=google.com; s=arc-20160816; b=lg0wqTVmZVnbU/MKZSwBb4PVaNJU9cQewU3ieYulFbM0obpIBi+drvhpWrEgntWt9v 6WOS3sGlmY/YQf6f8EjpcCXAN0z7+T2PiC39CF8j7UlvJQtg1D0o8hjgxD9yt7FauKfO rQcat9cM6xYPrwQHauzyou1j/D9f4VTmMic7H1bYx1RClK85FGpxrxsg16o6YMLs1CPG iHtq4ZHRy7SI8csdh8fc+QA+8Mx8c3HbmvfOioBuLm7dj1eb75/I+iu9T3VwL5CgWPKd Q003MPONJCL5wqfgI4LG7dK7sG70NMuiqn/w1o0Aw5IQdQYp+nCZHdIuyK0XJVmz39D4 NDGw== 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 :arc-authentication-results; bh=AFSbdhcE8Sfw3CtsxMnEziJ9HRWW8pTys6cp0oxdoPI=; b=eJKI7sALQAjye8Idc3lK4maGb6c/faxjzGJgnmW11hrJuf6xCxJkyiNcWW9e5agS/f 1l2uHPbL7DWks/8WeNTVWXCtls1hJGJEOeWRrMftETy+Pk+Zc5ZGYhoaVo8Yc9Em6fMC FZBjV7Vhw9cOtnqt6HQtA8Wor/2yTy+c6QgoJ/rhdmvWnbyPyuJlYudZw5RO8ZyrXKxb CpIL3WSx8bB2bbJcNJJymH1AtNyXoz8qFJJEUNnDqO/nloW69RgjrBpAbicSbC1DMTrp a5vwhqaUHmNhvuqYspC2B3BEte3bSk3b41wxtmeuOsq8HIHbTvmG1ITmqrbbm8VLeZL5 J4KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YsylSi0P; 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 69si846005pfv.15.2018.03.13.15.04.33; Tue, 13 Mar 2018 15:04:47 -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=YsylSi0P; 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 S932397AbeCMWB3 (ORCPT + 99 others); Tue, 13 Mar 2018 18:01:29 -0400 Received: from mail-ua0-f179.google.com ([209.85.217.179]:38726 "EHLO mail-ua0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932197AbeCMWB0 (ORCPT ); Tue, 13 Mar 2018 18:01:26 -0400 Received: by mail-ua0-f179.google.com with SMTP id f5so805363uam.5; Tue, 13 Mar 2018 15:01:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AFSbdhcE8Sfw3CtsxMnEziJ9HRWW8pTys6cp0oxdoPI=; b=YsylSi0PpISj3C4CrWVwk51j9upZbB26PE2rqIIVEqcEXciLiYAm2+oOQdHCQj6n5d Rppqj9G/DxanEh/6g02yoyXCf5wikFCZtkPwn7yPcu5ynnPYxN7+8KEn6H+8NRzKSpwK XRLEtyFAAmQ/agwsAYWV2H00Y/DjDUtExltJwzWfdZWVZxFrnqIICMxvYlIzj4RwWouX VE5MPTvBwvRHY5/Z9JgV+d5WNC5MmSHJWYtZ3Z0UiRFHPqgDCARk0VG3FqUXY8dADhsL AaO9RFgt8e3h6Ab630eIwtazuGnGxT3SnqST4n/A1K1H1n4uheNmbJlLWylwTh1Jqwof hsww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AFSbdhcE8Sfw3CtsxMnEziJ9HRWW8pTys6cp0oxdoPI=; b=V1Un/GqEsz1dh+iO8cPGiPEuU4ndn/4pv+jResAzQjyuLnGye8UJG+dWXFygpFQz3t UAfR6rd+wENCJp81Lf8fDxROr7u71pjAAL9InGN6dMxGPz55iOfomikW+8voRiyoK0by TDhJ5jwgizTBwvCNLQX8m0WDuGhwmr0lXuqL1q41/tzDgb/6tmWeDrbvI52J2qOEOg2n OgLuovUd+9PG2aedKCQe8V7fBVHp2JX4kS0JGz9WbmUzBQQt3ZiSE+kTwbA5DYsOfBUF 5nVUzDSg2NhC0TE8T+UzUWR3egN2D+xRPhXtrcEcaULupLuy9fMnOfycLLHAMeOY19tT U0vg== X-Gm-Message-State: AElRT7GsGnt87OCx4dx11uGsy+cKl0CVAC20HrzhVgiZelHS82+fVa+c oF76snbFIUygxcgNxOoUhSkIyooDK15V1aWCfng= X-Received: by 10.176.72.72 with SMTP id c8mr1890618uad.150.1520978485440; Tue, 13 Mar 2018 15:01:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.170.7 with HTTP; Tue, 13 Mar 2018 15:01:05 -0700 (PDT) In-Reply-To: <87fu5321du.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> References: <1520970647-19587-1-git-send-email-s.mesoraca16@gmail.com> <87fu5321du.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> From: Salvatore Mesoraca Date: Tue, 13 Mar 2018 23:01:05 +0100 Message-ID: Subject: Re: [PATCH] net: dsa: drop some VLAs in switch.c To: Vivien Didelot Cc: linux-kernel@vger.kernel.org, Kernel Hardening , netdev@vger.kernel.org, "David S. Miller" , Andrew Lunn , Florian Fainelli , Kees Cook 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 2018-03-13 20:58 GMT+01:00 Vivien Didelot : > Hi Salvatore, Hi Vivien, > 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. I can rewrite the patch using kmalloc. Although, if ds->num_ports will always be less than or equal to 12, it should be better to just use DSA_MAX_PORTS. Thank you, Salvatore