Received: by 10.213.65.68 with SMTP id h4csp562029imn; Tue, 13 Mar 2018 13:08:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELsI0a7+e4LXfegwuU9ezzxUyqXq10LimWhUbvotzcI4lEOX6EqPoRY83pZTbMH+SIfj3i2n X-Received: by 10.98.61.73 with SMTP id k70mr1794628pfa.10.1520971700777; Tue, 13 Mar 2018 13:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520971700; cv=none; d=google.com; s=arc-20160816; b=CkKmODyv9VzY7GPW7YYoiubSOZzDHK5TSzkXS7Stkbv2Nt1Q9E4sA/YmkxQ7BcXw7Y 0G75Du5T/P3IwOQ6B2Tjnfpvz3C063TZjxuYB8eeKKDhOinnlJX1U1xDXeuOThyZJXhN wQlmz12z0BMzBHomdYbRBmjIPd/xJNrAZJCWKSZeIOpcbAhADom9Xgz7NwZgbsWN95cY mOSm0KUx7BO+M1d3EKyZBhdO2+xzBggmr6mv0+98mSowXc7GndM9pot8NfC3JtVgulw0 ZFl3HmgwbWwU9sq9l1DM++/bpyiFy4G6CH4C8JZRuQopbVsPnKJjlvCpUcBKHA7WeGLZ QIcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=6jVRncZ3RJv8kqRX2W77wx+aLKbCQYSwrTsBGl5uTYg=; b=fw11Y7gCQKYajNX1O5PXpZeUHtFdwAKDX7vGfK712m/KBAAVbg1KJGDQzYAXsJTNIy y9oGTi3I5NWB96HB8VNe9Qc7Htei3QKCJuI7z9rveq6ibujElkEf8FL6ld4CnVfOia34 qJp7YLKMnjcpCpBlLO7dbsxgADCaf7dKa/YCOdIQCLmyQnlqtawyqYrhGJbucX5MgDLu 6E/MliYFTMHbQLeYLAS04nzolR9WLPFemocggrVzj07uZvRinpG8CMsih0bTgvdijD8Q Po+7Ot5jG7HuvbtsUgr+44FcwbiFRBVqyubdw10UnhOSA1etxX8+RV9UPePNMCEnrt8p 6kHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uZ+ufC2o; 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 d4si578846pgv.560.2018.03.13.13.08.06; Tue, 13 Mar 2018 13:08:20 -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=uZ+ufC2o; 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 S932468AbeCMUGq (ORCPT + 99 others); Tue, 13 Mar 2018 16:06:46 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:56242 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751997AbeCMUGp (ORCPT ); Tue, 13 Mar 2018 16:06:45 -0400 Received: by mail-wm0-f65.google.com with SMTP id q83so227141wme.5; Tue, 13 Mar 2018 13:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6jVRncZ3RJv8kqRX2W77wx+aLKbCQYSwrTsBGl5uTYg=; b=uZ+ufC2oSIQ4iZ+4PnDKstDvaO0uOYEUwjjYq14OMhH67KwJL3XUyg14FcmWJqK4H6 oEvtBKQkDKufFHV0nXlhnst6jVeb5K+0G3s3IArRMpIXa/BQgANo8BrzDhhL17zHZYWj F+nGP6pSlUJiySyECJGajzJk5Rur9mLfdxs5/VGQyWoT/+2HCN3ouwsG5Qw1Pi3cO3F9 kuqLUTvfvmaisP9e1TqVCV6eY4H2w4OzvD7se1waMd53p7xLRjYLxRMK+HeGbc2nJIQI gJSwLJE1/z2uLv4ULOqQ1DBMtVfNIPmAuNhtPipOdLqeOYEDAInF6ycpqWTSxuNTAcil trSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6jVRncZ3RJv8kqRX2W77wx+aLKbCQYSwrTsBGl5uTYg=; b=DzJpVqUB6Q4nYIneRaFou8+egrM5zW/OGz/8ww0LT3d24HHo+YtmxuSaKqC9c7ldiT banBaxGZDL2d2pEmrxITRzu5Vatry7XXNSAfuyQ+7RTQbjeCB1OCVZqrzKY6IyqbtUJ+ iVPEB9BK1A/qnUSUzdXIXUKIh6rTsn17Cnuhvhj79IWJlXH/Ej2kxgcOy6mO9K/SH/6l JrDA6ByeN1L4bKLIkJKTWV/YIK7F4cjcOHObOiZyhVMSaJflXikafPToNQxkkT6hSYkB n+HfeSr93PeVEFa7PdfShy9MsQoQ7dKEmeGyMqw4ii7KjAuP6hzKtuaKOa0McRr+Ey+l /kRQ== X-Gm-Message-State: AElRT7GsawLpKjUWb/lpJXfLoNNobewB9ncw9OOEkB0JfytGQzv9UOIL 1wU3Wg9RzYK5NZFm6q9dcQg= X-Received: by 10.80.139.141 with SMTP id m13mr2107721edm.164.1520971603601; Tue, 13 Mar 2018 13:06:43 -0700 (PDT) Received: from [10.69.41.93] ([192.19.223.250]) by smtp.googlemail.com with ESMTPSA id d22sm717807eda.70.2018.03.13.13.06.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Mar 2018 13:06:42 -0700 (PDT) Subject: Re: [PATCH] net: dsa: drop some VLAs in switch.c To: Vivien Didelot , Salvatore Mesoraca , linux-kernel@vger.kernel.org Cc: kernel-hardening@lists.openwall.com, netdev@vger.kernel.org, "David S. Miller" , Andrew Lunn , Kees Cook 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: Florian Fainelli Message-ID: Date: Tue, 13 Mar 2018 13:06:33 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <87fu5321du.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Florian