Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8510786rwl; Tue, 10 Jan 2023 14:47:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXuLYD5r/v6DLiUi1c4By3r0v7hmKEXTtUVm5hyKC2IVw7TqbgezHjb67s2S1/B8POnD0Sw5 X-Received: by 2002:a62:6d03:0:b0:582:998a:bed5 with SMTP id i3-20020a626d03000000b00582998abed5mr143275pfc.23.1673390838930; Tue, 10 Jan 2023 14:47:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673390838; cv=none; d=google.com; s=arc-20160816; b=QYCQ4vOZ7MtB56Y6dhb2A/5NNomgSvUMY8oIhZCH8+lqXZyPziCaqFA8vT4SO3u42k nt51K/CmJvgfwRUd2VgAIFJO0r9djmyhHgPJE5stO8i7+/d7FZTNpVVvI07LDCcoXPWt WaYwrieJSnPrBXypePdf8hISzNVieqXZQZ5DxE4yggH9oF6yyVJHOFi3qZ37zrbQl/PZ cyB3SgogDf0RvTN7VylZcwJ273ZugCWWcwFJSqw1fDcYHZVMUefp+rCUG88ho14YVIOt EMV95wOkc5qYBxLRSRV7/9lmHCAwlAjxsNlD88YXW1rAmUUPx9T6cZ5tVl8KsGTQvrJT x2IA== 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=fusWHzDKBqgii1AVavc48kT4VnTvdICssye1rnjn4y8=; b=PGZkWn3ewIPnNgJVwLMcPuOFAJtED8GIYmSNm+7okvsNmsIsyWRFdUHhux3amL7UTs lJ78OIouhQ+4F8cHJ+cdLbVgYlmKZ199l9zlsFdV/fnm0JIoSw89qlKHcGvAVvlhmbbk 7vyVMwieiD3i7o2wHPQ/Da5LEb1DWfzvzB8wyrfU42nIBwzP9Z27iC2GwJ27ffuSEHbO NQIo8/z7TXWqonXAZDUuIQmQTn7I9Hnw2U9kq1nM1VdIT2m3ACzMN/uXJDuAJlk+36Hy 5G0WKBBJEkFfFle+Ma/6J3W2jWBJgINQqqnhAPEJfbs/UShQRZiSNt2ryCLJAj/mcUfz G2rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sU9s4by+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020a056a00230b00b00581495f1399si13770590pfh.358.2023.01.10.14.47.12; Tue, 10 Jan 2023 14:47:18 -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=@kernel.org header.s=k20201202 header.b=sU9s4by+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233179AbjAJV7J (ORCPT + 53 others); Tue, 10 Jan 2023 16:59:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233314AbjAJV61 (ORCPT ); Tue, 10 Jan 2023 16:58:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D3EE5E66E; Tue, 10 Jan 2023 13:58:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CD8C9B819B4; Tue, 10 Jan 2023 21:58:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D61AC433D2; Tue, 10 Jan 2023 21:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673387902; bh=M6PirtylDWfnwWQmbjPEjODf22EUW9BcFhvH7EqNPYI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sU9s4by+WCKy6xxqQ+Aiitpj7ZvPzszpLBJf5jHuPpEujM1ElylI5DbW1fiKfERil GfvNgssm59seDKEOBa8gZAWyyGSTddXmEH82vECUpHhwldJDu5Y6DR9FpOXUQeGpkg 3FcUsj8hpSArzsGYOO2orIGYWamVRoNzFetbDo5yYwP/KWz3RzZ9YCmsQxFWdjt09c sbJtTXXTZQmDyViTKMTQ/39WBz5IHPYJvaWmnj4cIYavt9jVUABfHMPI8naobJRc68 39SMg5DjPcgoA3PQVY8buOuktbE8bH2QMDpG9w6nkQkKcXNZe5UwpQJVHipAPWhV/O aite6/RGqReWA== Date: Tue, 10 Jan 2023 13:58:21 -0800 From: Saeed Mahameed 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; format=flowed Content-Disposition: inline In-Reply-To: <20230105223642.never.980-kees@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On 05 Jan 14:36, Kees Cook 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 Applied to net-next-mlx5, Thanks!