From patchwork Tue Jan 10 01:40:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 41251 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2488275wrt; Mon, 9 Jan 2023 17:42:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXsuJQGbCk9fdkuh3JW6CClPhBC5V9N7BsXVIwIp+iE89kqttjU4/f7rBLavCfW6HSNUIRC1 X-Received: by 2002:a17:90b:280d:b0:21a:1f5f:e798 with SMTP id qb13-20020a17090b280d00b0021a1f5fe798mr71261817pjb.48.1673314942276; Mon, 09 Jan 2023 17:42:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673314942; cv=none; d=google.com; s=arc-20160816; b=k/smD58u8OHdIN+Nzh2odLynAiP6hjrTTg0XGtTtOmI4SuZtUtFXh8itEcgs3/9oTm ax/XaicJ6tRp19bQ+ump7Z2drToMrsqL2twZ7B3EobiF0KJvmsFwcrzlXp8l2wQWwFPW i8+lZAuSRr8PkFFWzSEKOmkBcWXRZ/PfnA5VGFkUYK9NP16yTpfDvxQjNrQf0R0mptD6 a9RjZAhTmfFXUyEqOdZyNoiWjVRAz9ezXEBONnsm84v9DQfqrRduADFloYWz8biQ4RHG Ma2vHBzxObraCwONv0PgYVSSp1PuZphI6c/QkuLUK4kOJh+LfFgwp2UcTA6BeEkAHe/L zayQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=OkLxhhAzOq3DXK8xwSGY4wQ5F1VgQzDW4Rh9Y7cQ5/U=; b=fWQZAlBl5fKpT8PZ9c3d7vH1n94RKVLDyiZ/V97m6JUZsRIy7SyP1ed0KRTpFvcXCK kQ2j5WrByqxp4ex/3vBZQ2zeLoA0dG/faVSL5oJes1OT2uvZTDcyykFRp5h9CwToVbfN 8ZnVQZOXdpGlstsrp+FV/zS0gZR5JmYhz6UZAD5iypaFDCSYBsqucRn3sz5bg886FYAx Lw3dmz8YHXjY2G2i480SYRO5DcSS3isOwMySrPZt7gp+jfvwT/1HEVncwiLkhcjiah3s OpTR/vSwTXFUFBUKczuDRKDRXe1MrxSCLr7JAFaym9S7zs1w5/r4xddr2DPDk9CpCl4F 4q1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e+J6F6dA; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q3-20020a17090a2e0300b0022688033d4esi9712848pjd.101.2023.01.09.17.42.09; Mon, 09 Jan 2023 17:42:22 -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=e+J6F6dA; 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 S235368AbjAJBkt (ORCPT + 99 others); Mon, 9 Jan 2023 20:40:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235313AbjAJBkV (ORCPT ); Mon, 9 Jan 2023 20:40:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0212D3D1DE; Mon, 9 Jan 2023 17:40:16 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 4E09E614B5; Tue, 10 Jan 2023 01:40:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77ACAC433D2; Tue, 10 Jan 2023 01:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673314815; bh=LFcmV1V/W4BleiubFsbg/Yh62d3qLU/7sOhf+QI1wO0=; h=Date:From:To:Cc:Subject:From; b=e+J6F6dAhWy+5bDkNCiVxxp6UNTQZiNCailDjUSTNvAJ0xt9RfcILPT+h7kqWM2UT bXxnb+0HUFo6dmEG4W/Q7A7zogQcp7fnewiErRYrdBD8ZTdZPxvwgvIluQStvK0y99 xbKoCrGqdoloO72CtX8OwwuVd/TKeSW0vq2FDHD1Fvm1V+VU6iLtfGCDoQ/dMKQ2D2 v0NiYWM/gEzSWvKGmD8FNwCgVxYToUZHjgjS8HYI1H+NsdP1is9Pk1PLq/GsOinVsH 2wwv9czE5P5AQixpAHbqnzkn1PGXyzFxJOOuE3O8gLwEuD05oV+gIr/X9wv91loRkX qOKNa0l2XA8aA== Date: Mon, 9 Jan 2023 19:40:22 -0600 From: "Gustavo A. R. Silva" To: Cheng Xu , Kai Shen , Jason Gunthorpe , Leon Romanovsky Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] RDMA/erdma: Replace zero-length arrays with flexible-array members Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754597888808279719?= X-GMAIL-MSGID: =?utf-8?q?1754597888808279719?= Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length arrays, in a couple of structures, with flex-array members. This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2]. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1] Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2] Link: https://github.com/KSPP/linux/issues/78 Signed-off-by: Gustavo A. R. Silva Acked-by: Cheng Xu Reviewed-by: Kees Cook --- drivers/infiniband/hw/erdma/erdma_hw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/erdma/erdma_hw.h b/drivers/infiniband/hw/erdma/erdma_hw.h index ab371fec610c..4c38d99c73f1 100644 --- a/drivers/infiniband/hw/erdma/erdma_hw.h +++ b/drivers/infiniband/hw/erdma/erdma_hw.h @@ -397,7 +397,7 @@ struct erdma_write_sqe { __le32 rsvd; - struct erdma_sge sgl[0]; + struct erdma_sge sgl[]; }; struct erdma_send_sqe { @@ -408,7 +408,7 @@ struct erdma_send_sqe { }; __le32 length; - struct erdma_sge sgl[0]; + struct erdma_sge sgl[]; }; struct erdma_readreq_sqe {