Message ID | Y3P1rEEBq7HzJygq@work |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2927263wru; Tue, 15 Nov 2022 12:28:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf78erdr/B+s4JjgoluXjOXP56FX5FBoGqmh5lWzbmT99h/2EnzZET78QHzFrrHvMNjYki+R X-Received: by 2002:a17:90a:f684:b0:20a:df72:e61f with SMTP id cl4-20020a17090af68400b0020adf72e61fmr120298pjb.87.1668544134280; Tue, 15 Nov 2022 12:28:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668544134; cv=none; d=google.com; s=arc-20160816; b=VKZUXt73XMHrLcizy0AwYfEIXtoIHRnGxp1Nr9nT2RPkPnFHw+FKp0J7MQmeYnoBWA 5U39EkPeyDxLnscL4C1mjwNx+ESDN+IdHPFtFasZkDKKRbovWv2eK1tnxk1Tz9RsB1H3 QAEcM6q/b9q/sYfzhQzQ2EGmO8Xvs7mMeC+jpbj+ETnvMdjJ3kuv/CouQxEax8EoVPl9 otPTBX51CkKrm76UoxI2VQx3B+BDQ0ZQgKu1MBkx7YLSf4zUFiIYfOUsL8xP9wqPTi6d 8nhHLoWi5Ll+mb0E634r+z/2gvgZ8fHmzo5/7UaYcusid54bc2xzDvpfGCVcjdk6Kpqh hHEg== 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=heXgMpXTNP+inze4shujDdQYQxvGUDut3Z0gFNZRVec=; b=dGvC3jz76YhIHgvwKS/neUQ4y9mKA2eQ9qxrDllY03ONjHGStijLDYL7tp89/i/BVP 3efAqeiC0JFpVFbtbos0ekEvGPaJmvZTFNXGGxkQUK/Urf+3bh2fQxX6YB1stiueveJx 0647GDpD4EVExZAsiIP/9QDbTlnz6gJCgA60igNjjOuN/CeWy98HYSe0mY1A5s7j4WQX eNoOt8UzMWN73DefvLEpfz0w/Cx8Et1l6xXDB2HDo0Z9ilkjlPGibZthHNxxM/+Lyyfy c9otg6oatuU1ZvJLTCyWDHo21/VyYGnKb9YSkRjIBvLBBuIwTgJ307/Zkx/Esxgn1ncL 8lmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Fgg0M1Pa; 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-20020a6557c3000000b0046f58089605si13238515pgr.272.2022.11.15.12.28.38; Tue, 15 Nov 2022 12:28:54 -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=Fgg0M1Pa; 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 S231142AbiKOUZe (ORCPT <rfc822;maxim.cournoyer@gmail.com> + 99 others); Tue, 15 Nov 2022 15:25:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiKOUZd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 15 Nov 2022 15:25:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FD796577; Tue, 15 Nov 2022 12:25:32 -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 E3FC2619FA; Tue, 15 Nov 2022 20:25:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4707AC433D6; Tue, 15 Nov 2022 20:25:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668543931; bh=wkeY+zmuuIfH0P91UWN754W6X7lV8EgxxsphFuXI3qQ=; h=Date:From:To:Cc:Subject:From; b=Fgg0M1Pa192/Avsm6D+UwDM5fJrY2sspV5S56Q+2trynAiKPqcStFT+abyT6XSc1/ a3x5kEAWQ+sZwqGN2K0FTFXyAZdYfUN6Mki0F8ZAudv4vZfDZ+u0gGMe6RDRJXWukL UrAyFqTp5Mc39jkIyvLQ72CN/beRH3tKjCTt+cTA7RMKzxEC6PaGr0wIHueFBRSjUV bV2vE5peSGuf1XnRLsrqSIftx4J3h+OftKuhb14g3jryyWGSZJotmApNd3daqKV3yh +OD4viYDiq4mM10gITPiTO7iDtLGMwdaEAt/kDTFf2CzRk2MjUQIQVGWg29SM34K7J 7Fj+EZ52eSMkA== Date: Tue, 15 Nov 2022 14:25:16 -0600 From: "Gustavo A. R. Silva" <gustavoars@kernel.org> To: Anil Gurumurthy <anil.gurumurthy@qlogic.com>, Sudarsana Kalluru <sudarsana.kalluru@qlogic.com>, "James E.J. Bottomley" <jejb@linux.ibm.com>, "Martin K. Petersen" <martin.petersen@oracle.com> Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" <gustavoars@kernel.org>, linux-hardening@vger.kernel.org Subject: [PATCH][next] scsi: bfa: Replace one-element array with flexible-array member Message-ID: <Y3P1rEEBq7HzJygq@work> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749595334243402751?= X-GMAIL-MSGID: =?utf-8?q?1749595334243402751?= |
Series |
[next] scsi: bfa: Replace one-element array with flexible-array member
|
|
Commit Message
Gustavo A. R. Silva
Nov. 15, 2022, 8:25 p.m. UTC
One-element arrays are deprecated, and we are replacing them with flexible
array members instead. So, replace one-element array with flexible-array
member in struct fdmi_attr_s.
Important to mention is that doing a build before/after this patch results
in no binary output differences.
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 [1].
Link: https://github.com/KSPP/linux/issues/209
Link: https://github.com/KSPP/linux/issues/79
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/scsi/bfa/bfa_fc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Nov 15, 2022 at 02:25:16PM -0600, Gustavo A. R. Silva wrote: > One-element arrays are deprecated, and we are replacing them with flexible > array members instead. So, replace one-element array with flexible-array > member in struct fdmi_attr_s. > > Important to mention is that doing a build before/after this patch results > in no binary output differences. > > 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 [1]. > > Link: https://github.com/KSPP/linux/issues/209 > Link: https://github.com/KSPP/linux/issues/79 > Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org>
Gustavo, > One-element arrays are deprecated, and we are replacing them with flexible > array members instead. So, replace one-element array with flexible-array > member in struct fdmi_attr_s. Applied to 6.2/scsi-staging, thanks!
On Tue, 15 Nov 2022 14:25:16 -0600, Gustavo A. R. Silva wrote: > One-element arrays are deprecated, and we are replacing them with flexible > array members instead. So, replace one-element array with flexible-array > member in struct fdmi_attr_s. > > Important to mention is that doing a build before/after this patch results > in no binary output differences. > > [...] Applied to 6.2/scsi-queue, thanks! [1/1] scsi: bfa: Replace one-element array with flexible-array member https://git.kernel.org/mkp/scsi/c/c4c5fa35563a
diff --git a/drivers/scsi/bfa/bfa_fc.h b/drivers/scsi/bfa/bfa_fc.h index 0314e4b9e1fb..a12d693065ce 100644 --- a/drivers/scsi/bfa/bfa_fc.h +++ b/drivers/scsi/bfa/bfa_fc.h @@ -1548,7 +1548,7 @@ enum fdmi_port_attribute_type { struct fdmi_attr_s { __be16 type; __be16 len; - u8 value[1]; + u8 value[]; }; /*