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: 13094571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE76BC67871 for ; Tue, 10 Jan 2023 01:40:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235141AbjAJBkn (ORCPT ); Mon, 9 Jan 2023 20:40:43 -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 Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org 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 {