Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8123448rwl; Tue, 10 Jan 2023 09:17:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXvoCaCpGJIhbbGcMupeq+pngkYLKrRVXAAg7ttghvDmCxw00Ho8yit28feyoJRgRGcy1SaY X-Received: by 2002:a17:907:a4c3:b0:84d:150d:5006 with SMTP id vq3-20020a170907a4c300b0084d150d5006mr16834869ejc.49.1673371039223; Tue, 10 Jan 2023 09:17:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673371039; cv=none; d=google.com; s=arc-20160816; b=ZtzyrwM3Cj51oGpPCVU3nhpPMM/wE4gtorQ/PT+xlfkvJhMkHWc2955Mv2796ODTGU dnUIn0B52gBpNz5xdiGbKYOA0Q7ClSmbaEZRALJaKzyS4FKEdk9R0x1F1RNJz/6TvAGd Su1XLXmP/Ren37ze4O/KMCmPj44iUFiYHTN3Q0obmss5IeCR51UR+mAiWEJroVEKA9+O 8U02EjQVSIbhPohZsyOLmnH7xAhqMVS2wnYfE+f8hCR352fvAJuBwskJp7XWffOBVBXU v7OsQ6bxDcadcyPnF4HV5OwChIeqwY8TolrHg447xTzriW0UmGb/NiV/8yVVmrRC46Vf P12A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4g3X2Drb8iDIejSiH0zFfNh5MOmbpVh8uX0CGV33Ygw=; b=Rr8sbPM5OAo/uWgNoy6pMQbBM3UjwP2/uAVIxCfWccSkljbKcNCvcWjE/e2goxLhrk eXvJz8rz57A+OfkyaUanxMxFUY6qprSmbaJNLqkS/NeVepukLjd/LEUpQt0LwSlWKH1H jyLe4uzR75+PbAMwbQqd3N9YkRwC8V3TqTP9IgoHyuOPacTyfDjKzeBsrqaIVW+uBY14 vYtNv5PZ9BQJok4h1BNQaUpwiLvr43xLFL7ldz/t+fRjzLWs4Q/WQhCQSU4Xpi/JJXw4 qnYrsOxb/p3PNZXmeH+qB8DycR93K7Afj3EzvA+kXXQaI48Z18nq5VgOeGJ+a8kg56JW yk3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20210112.gappssmtp.com header.s=20210112 header.b=jie1h2bF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di6-20020a170906730600b00857c01c6b3fsi2009345ejc.164.2023.01.10.09.17.06; Tue, 10 Jan 2023 09:17:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@resnulli-us.20210112.gappssmtp.com header.s=20210112 header.b=jie1h2bF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234290AbjAJQaT (ORCPT + 53 others); Tue, 10 Jan 2023 11:30:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234473AbjAJQaP (ORCPT ); Tue, 10 Jan 2023 11:30:15 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ECF9736E9 for ; Tue, 10 Jan 2023 08:30:13 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id jl4so13729958plb.8 for ; Tue, 10 Jan 2023 08:30:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=4g3X2Drb8iDIejSiH0zFfNh5MOmbpVh8uX0CGV33Ygw=; b=jie1h2bF6T0loL1kylf5SLvyS0ttCfxL/U79701D7Jc+1IkfwixBN4MpGFNc441I8n rl0JBa3hUIvLS36GCdBIOkhpDcy/IDVIRWp/yuSg7PBI5ZSeQGLc7GZdZZgOKi+pYn0C HTRafMDZ1/gTGXGHjLx51tT+oXyMQxAoExxDwWKMu+++bGjk/5umgA8bQERjXhqxXTRy Q9uLnPmQ95UgBpIOzxuMsD6nfq/g9vJjvXaGHSOn42vQFuUVv2v8Y65qSxqIntgEXMLY 0eahvmjKtp0NDUvPgAIpo38znxs8UvEjKhKVEiFgKQ6tmpjKA3pplJfAAcTpVJ3Ija0e kXNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4g3X2Drb8iDIejSiH0zFfNh5MOmbpVh8uX0CGV33Ygw=; b=qGIxEr1cmAitiCTlpNa+l+pcqq4SQBRU/K9NzS1t4ah6M/OCITONWTVL9NAn7JsjQ6 0SxYqRSK+HtTLcogq7FwNXNQKGt64AUBOyct/6aaHuLWTxWb9pv2LG7gaWJhTD9Sdj51 1HM0SsSi8qrWw55FfrresqpBzN65c+2CNOqQB+kNmonAQ4jHtXpQDpMgV3oAKdPTHP1R +IdoiCHz+O+35vmfRIvzYpwbs+wss1tWivg7w9ZhI1yrZ1NFndNEwNwlAuYYgk0Y9sPd Oo+YZeKNZyDeJIMAU1GntSo685Apf+H97wsU6pqjnsdnn1y9BTV6QbHswQNb7+gZYEdg CM3g== X-Gm-Message-State: AFqh2kpQ1H0Wik3RIzLiVhvO5VLVQKEyHu7UlWeM3Q5kzRBC7uDagI5Y pfOyYIjuTen2EKWgYXEgQ9Bvvw== X-Received: by 2002:a17:90b:3557:b0:219:bd64:8e60 with SMTP id lt23-20020a17090b355700b00219bd648e60mr73264459pjb.34.1673368213082; Tue, 10 Jan 2023 08:30:13 -0800 (PST) Received: from localhost (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id y7-20020a17090a154700b002265ddfc13esm3213456pja.29.2023.01.10.08.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 08:30:12 -0800 (PST) Date: Tue, 10 Jan 2023 17:30:09 +0100 From: Jiri Pirko To: Kees Cook Cc: Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Gustavo A. R. Silva" , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] net/mlx5e: Replace 0-length array with flexible array Message-ID: References: <20230105223642.never.980-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230105223642.never.980-kees@kernel.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thu, Jan 05, 2023 at 11:36:43PM CET, keescook@chromium.org wrote: >Zero-length arrays are deprecated[1]. Replace struct mlx5e_rx_wqe_cyc's >"data" 0-length array with a flexible array. Detected with GCC 13, >using -fstrict-flex-arrays=3: > >drivers/net/ethernet/mellanox/mlx5/core/en_main.c: In function 'mlx5e_alloc_rq': >drivers/net/ethernet/mellanox/mlx5/core/en_main.c:827:42: warning: array subscript f is outside array bounds of 'struct mlx5_wqe_data_seg[0]' [-Warray-bounds=] > 827 | wqe->data[f].byte_count = 0; > | ~~~~~~~~~^~~ >In file included from drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h:11, > from drivers/net/ethernet/mellanox/mlx5/core/eswitch.h:48, > from drivers/net/ethernet/mellanox/mlx5/core/en_main.c:42: >drivers/net/ethernet/mellanox/mlx5/core/en.h:250:39: note: while referencing 'data' > 250 | struct mlx5_wqe_data_seg data[0]; > | ^~~~ > >[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays > >Cc: Saeed Mahameed >Cc: Leon Romanovsky >Cc: "David S. Miller" >Cc: Eric Dumazet >Cc: Jakub Kicinski >Cc: Paolo Abeni >Cc: "Gustavo A. R. Silva" >Cc: netdev@vger.kernel.org >Cc: linux-rdma@vger.kernel.org >Signed-off-by: Kees Cook Reviewed-by: Jiri Pirko