Message ID | Y7zBtCZ/eRJCpjBf@work |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2487749wrt; Mon, 9 Jan 2023 17:40:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXsr2JvrqUJM9U9Xao+fB2HtF6XrhMyPybtfj4DO2Wyhy0dDph+NtVqTtXiRn7EshDzWem9b X-Received: by 2002:a17:902:c643:b0:192:4c84:4508 with SMTP id s3-20020a170902c64300b001924c844508mr61744839pls.20.1673314851050; Mon, 09 Jan 2023 17:40:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673314851; cv=none; d=google.com; s=arc-20160816; b=InQcXUJAqtxMSaU+/B6morqLXCHlyx69+lnJbjgdPgrZMoJibYbnXh7dqOAfhNK5xr /AROTul/c8tR7bvMdPtK78D9tozYCW7nuS1LVgs6d5egXKrkGrmmgU29oEJ0f8kHncgO R52fXXnNOHegkSB5i7cg/wLNaFNcNzbRqo+7K21wzFKIhNYxKkYgbAHPvDE2M7FzaVr5 ZTKhG/ap5Zson/fiIHRt8aEHeqEXUgYIBzazKply/UKLOaL462WIW6yfNrsTC7FzVZdD e0MksblIxA07uBvY4HBULxOycC0V7Z5sImm64Hiap71bK+Q+gGLZMecaDScFOqeACx/W WzHQ== 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=nP4JjRlFxDZtCsFa5Wll9KGqjrDnpw/LMsKUxbfq8Dc=; b=DCpMBD6h1kT7L9jneKKG+567IlAaVZXvQCRDo+6yCb1JPLw1VNgKewceQTQT4fCgYZ wXkhwTyWMYPULAJb/LoaWsLW5LZqIKaVnuVgW2HeWbEsgjUZlJ5xD1PvbuifKP2VMxmV jewq/XHsU03TLRaUyl1HGBjuwK/m0T7f3i2vz5pOMeefmxFTYTtoM6kX4b1x4zF/WSFc gJ4tLb8jU7JHypXzX7D6EQTJ+q3XCOf2nUlUXGnaNhz95r/36Oib7m3pOthsYaSP35FO QLm9L2GqmoHus2HoVkaIl2aJ0xQc44mpVrvidL7/1Pky0XQ9NrZl5nALvWyIGw5EzX/Z 3+gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MeU5vqR8; 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 21-20020a170902e9d500b0018962933a3dsi9451268plk.206.2023.01.09.17.40.38; Mon, 09 Jan 2023 17:40:51 -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=MeU5vqR8; 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 S230222AbjAJBi5 (ORCPT <rfc822;syz17693488234@gmail.com> + 99 others); Mon, 9 Jan 2023 20:38:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230087AbjAJBiz (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 9 Jan 2023 20:38:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED03B203D; Mon, 9 Jan 2023 17:38:54 -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 7BBE9614A7; Tue, 10 Jan 2023 01:38:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54760C433D2; Tue, 10 Jan 2023 01:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673314733; bh=0KsXPwa+vpt2uUTuNq9JANlQlF0R1EPm/dJEZEJYJRs=; h=Date:From:To:Cc:Subject:From; b=MeU5vqR8R1uSRt9MD3bd3OrrRjIKXeUY0UbHixtqY/UGpVkda6zofuFcj9tc2X7ZY LGr+WYf3JykV0N+ugVYi+j8TZBz/EtV4zyy6Z81IOB4AFfrdleLPDXFESRi6cJUoS6 7QKRubuUaS47zGylZ22cekIk2QZyAVjr557j/eqND0TYwj9y8CsH7exppiJU/N61ib l9LtIkojiEQyu3cfmUEm8yVgmCTo5ioUILyyr1IdoP7zdmHTvY7PRte0hRNMTCovXb EalNqY1wl4iSNJz69le28Y7UsZ3z4+DxUapCoxxSbUOHn5vgRUYMYHkbvyxeSprQwk kgvdH0w2y1ZBw== Date: Mon, 9 Jan 2023 19:39:00 -0600 From: "Gustavo A. R. Silva" <gustavoars@kernel.org> To: Steve French <sfrench@samba.org>, Paulo Alcantara <pc@cjr.nz>, Ronnie Sahlberg <lsahlber@redhat.com>, Shyam Prasad N <sprasad@microsoft.com>, Tom Talpey <tom@talpey.com> Cc: linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" <gustavoars@kernel.org>, linux-hardening@vger.kernel.org Subject: [PATCH][next] cifs: Replace zero-length arrays with flexible-array members Message-ID: <Y7zBtCZ/eRJCpjBf@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?1754597793500298260?= X-GMAIL-MSGID: =?utf-8?q?1754597793500298260?= |
Series |
[next] cifs: Replace zero-length arrays with flexible-array members
|
|
Commit Message
Gustavo A. R. Silva
Jan. 10, 2023, 1:39 a.m. UTC
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 <gustavoars@kernel.org>
---
fs/cifs/ntlmssp.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Mon, Jan 09, 2023 at 07:39:00PM -0600, Gustavo A. R. Silva wrote: > 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 <gustavoars@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org>
merged into cifs-2.6.git for-next On Thu, Jan 12, 2023 at 4:52 PM Kees Cook <keescook@chromium.org> wrote: > > On Mon, Jan 09, 2023 at 07:39:00PM -0600, Gustavo A. R. Silva wrote: > > 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 <gustavoars@kernel.org> > > Reviewed-by: Kees Cook <keescook@chromium.org> > > -- > Kees Cook
diff --git a/fs/cifs/ntlmssp.h b/fs/cifs/ntlmssp.h index 55758b9ec877..2c5dde2ece58 100644 --- a/fs/cifs/ntlmssp.h +++ b/fs/cifs/ntlmssp.h @@ -83,7 +83,7 @@ typedef struct _NEGOTIATE_MESSAGE { SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */ /* SECURITY_BUFFER for version info not present since we do not set the version is present flag */ - char DomainString[0]; + char DomainString[]; /* followed by WorkstationString */ } __attribute__((packed)) NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE; @@ -135,7 +135,7 @@ typedef struct _AUTHENTICATE_MESSAGE { __le32 NegotiateFlags; /* SECURITY_BUFFER for version info not present since we do not set the version is present flag */ - char UserString[0]; + char UserString[]; } __attribute__((packed)) AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE; /*