From patchwork Mon May 15 19:22:48 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: 94308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp7142440vqo; Mon, 15 May 2023 12:24:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Sdq4lr1hE1cz65IWR0WupCQgxbX1UmQ0S+JjXIKuuOs3BGOPSbFAU/UPxIesVFruAGc4p X-Received: by 2002:a17:90b:4c4f:b0:246:85ec:d816 with SMTP id np15-20020a17090b4c4f00b0024685ecd816mr34195802pjb.3.1684178671794; Mon, 15 May 2023 12:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684178671; cv=none; d=google.com; s=arc-20160816; b=d+cmtw5AQxXkexF1yCIAu4F+I0SiXZK7A5zNfJT4IjXruR4DY/hXcew88h544mE6+y U+UpE9bvgwo0nyC0IjsXbZG+lWJc2lpa8u6wQU20WW4jH+UcyoH1Qjgdx0EeqOHtR87V Zl4ag4Z5otQW/phnm0E1TCrBXFynoBIagidmRy0RJSyNrBy+MuFB34uefpaYR6V8Ao3a txO0wYXweWUMDLi1n1o1+10ozUpRhhV3S2+MixAb7fbvvPoF5YQIvcqyTpAIPYMa+k6d Jwcr+dslljPsBiMGd2zUsArVNcCznelc1ekhtO1UsG4d2mcu5P5nyxI8OLzLy6bETYZd SVVw== 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=wjjiDplHfM3i9eaXKJhLJtlmCiV+2yi9r2kRUErboPM=; b=PcZ/I43LF9j0TzbmAUXMexVHtrcWApvr48+LAc9I0u1Vp2AseTKOm6Nqon8HptYXFp gOknw5/tT6cK5cu28fISvPy8EnDqZ5u7/2A7f4e992f0g5FUe3i7+OH2Yb2dfi02qErE Xswni9uMHGTXPLUgW6ngP8jHOxQJYr5uA/xUYLbxxgHRhDhnODMxqZtCn/SfpWLNB/iE 8IGswMPjiIh0BceiSY1zCuJDxgTM1pIOL/+OYXu+vos/46UIekYoV0E3+9OcK4UcWHvm /nPP3f58RGx7GqPundyJhck2UbqgLqOZRJYpwiQo8RsXghXKhWvEbocTzgEtT5Zp4dKL kt+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=V5k6DIgi; 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 j190-20020a638bc7000000b00528519a4371si16633966pge.516.2023.05.15.12.24.18; Mon, 15 May 2023 12:24:31 -0700 (PDT) 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=V5k6DIgi; 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 S243996AbjEOTWE (ORCPT + 99 others); Mon, 15 May 2023 15:22:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243925AbjEOTWC (ORCPT ); Mon, 15 May 2023 15:22:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26FE7A270; Mon, 15 May 2023 12:22:01 -0700 (PDT) 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 B6B1063173; Mon, 15 May 2023 19:22:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04484C433EF; Mon, 15 May 2023 19:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684178520; bh=dzKqueiaHaieX4+u+VL0PHmUBtkteWDdFF1DX61gWSE=; h=Date:From:To:Cc:Subject:From; b=V5k6DIgiH/dlVpUdsMUEr8rKPeg7MPaQ60Bo5vOUKYZ+ZhNZVVZxwVgNFWRs/PyE+ 815d/HlzGv/AsqhaZIJa+eAxpzJVczrik3YjSBNBB1Qbb9NVPwNSVncciDaxzO2TwU surfV1shNXy8mxM5ph3+IOaSCmxSitMoeuac9dfkikbLllgRvUbk+6tUX5zqPdORcu LlMQNu1uLuSmGgZLyVUi+SdoGBdLR8lqhmXduFSaF1gILEzT+xXDhO+TECAsoAfbns WtiGrJ5k//Onnyle/pkcsKyXmLb92tcE3hALUi5gGuEDdx+/LsDKvQcb1QidcxDP62 jKNQHRzlQ67KA== Date: Mon, 15 May 2023 13:22:48 -0600 From: "Gustavo A. R. Silva" To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: mlxsw@nvidia.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] mlxfw: Replace zero-length array with DECLARE_FLEX_ARRAY() helper 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,T_SCC_BODY_TEXT_LINE 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?1765989335188225819?= X-GMAIL-MSGID: =?utf-8?q?1765989335188225819?= Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations alone in structs with the new DECLARE_FLEX_ARRAY() helper macro. This helper allows for flexible-array members alone in structs. Link: https://github.com/KSPP/linux/issues/193 Link: https://github.com/KSPP/linux/issues/285 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Ido Schimmel Tested-by: Ido Schimmel Reviewed-by: Kees Cook --- drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h index b001e5258091..47f6cc0401c3 100644 --- a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h +++ b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_format.h @@ -44,7 +44,7 @@ MLXFW_MFA2_TLV(multi, struct mlxfw_mfa2_tlv_multi, MLXFW_MFA2_TLV_MULTI_PART); struct mlxfw_mfa2_tlv_psid { - u8 psid[0]; + DECLARE_FLEX_ARRAY(u8, psid); } __packed; MLXFW_MFA2_TLV_VARSIZE(psid, struct mlxfw_mfa2_tlv_psid,