From patchwork Mon May 15 19:24:55 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: 94312 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp7149384vqo; Mon, 15 May 2023 12:39:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5swvtuOcRnrRBhgRSmpv4277ga3m9ms86+HRneJqWaV9uz356qxLV4tkyP+oPjrOcN7Zc2 X-Received: by 2002:a05:6a20:12cb:b0:101:586b:4288 with SMTP id v11-20020a056a2012cb00b00101586b4288mr27152392pzg.7.1684179555949; Mon, 15 May 2023 12:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684179555; cv=none; d=google.com; s=arc-20160816; b=VrJgMFaWG4p2qudlJHzoSCzFaSCCzpLJmpWOueqNRuxrVcrwFTo65ZIyUWRfRZk302 b8ha/I6JxEiNHN/r+8OfaeW/san3KrLrOY2QPWD9x6cEsYyFoJnZgaFmNrAhTKOPRBpJ vWfaVHa7uItA3dZYwH7kMs4WodomyVcrEraR1td+GRZ1wejrot+KEaoCOEcFaRqfS/Ol XNJscqz2Toeu4OOlG0aT76fRigqsfOz+YAkyv3qAQtfq7OdFnwSs3R+Ja2NtaiJFK5Vl LVnc/kspZvgQ1ekzfd6f3FSpOQGgVs/4U6Zbw9BkE58pMOp0aRz36MFH5Go856FgUsMy RmcA== 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=4dLAgg5jyMrmENBFYWuIw8FaRBEdQu+1xMC/+zyop7Y=; b=kyh1jOYlPQl6yMBIsKP1c4TQgWB/6Bb9EGlbINP1W5hOWxFHu1XMl6dCoVmhzg5MZo vczaeXEI2j247hpGChV8iYkgynsZft5sOJ3P0k5zILYN/agLGEQLPc7e+HHME2NcyoGK IVMHxHrMVP8XbDicyFd5GVG3/AS80IokTCPHlt8nI9YMW0orKdpmSaQduAGfFPMTE3kS YeRG7tXeEhXKhOeLicKd7Zhz4x1yU3+Bs6jjlVl/B5HLbF3N8IWy6TFGg8hBpTjaDmAO NJ2lt/hDqTzsxMnG+OUDoR39CwKzWihg66blDxHab7HFhFaKpq+J9fRxHv65q7szOS/P 07WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A5CiJtDI; 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 s18-20020a63af52000000b00524b3efc31asi16925250pgo.737.2023.05.15.12.38.42; Mon, 15 May 2023 12:39:15 -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=A5CiJtDI; 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 S244221AbjEOTYy (ORCPT + 99 others); Mon, 15 May 2023 15:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245219AbjEOTYV (ORCPT ); Mon, 15 May 2023 15:24:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B97441643D; Mon, 15 May 2023 12:24:07 -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 5660D62299; Mon, 15 May 2023 19:24:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A8A6C433D2; Mon, 15 May 2023 19:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684178646; bh=q0fr9L7z3JD2gn3NXYVjkph6/iEcTo88CXHUvYj1KB8=; h=Date:From:To:Cc:Subject:From; b=A5CiJtDIEzB0JjF6pW+io36+Hwt4X4BHAvnJK56vtYydPVlK3AUoHIuStNvfJwUTg bHD3yARQzu8ZdedRKcM+Xd686MEV2fWZdLQdXNO94vBUfBdvgisr3ngAC4B77lXWvZ LfZb59zjgddNNSWvSHynNGVk1k3NG+jLoLo8jg6RotdJqB3o+NxCAPurCuD/bTQ7VX MtvUxG8LqTo5LY+GTb3pqjh/McCD8L69q0h04+Xou509N5uJTYG+sJfcaU5uDFVGzr oXKr8IS2/qXwy28Fuj5R/PsvQATqccUnNVxvw4DaaDQfgRSsuDBAO7ovBFKB+4uNDs 24InHsAU8zB0g== Date: Mon, 15 May 2023 13:24:55 -0600 From: "Gustavo A. R. Silva" To: Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] wifi: wil6210: fw: Replace zero-length arrays 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?1765990262111525004?= X-GMAIL-MSGID: =?utf-8?q?1765990262111525004?= 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/287 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Simon Horman Reviewed-by: Kees Cook --- drivers/net/wireless/ath/wil6210/fw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/fw.h b/drivers/net/wireless/ath/wil6210/fw.h index 440614d61156..aa1620e0d24f 100644 --- a/drivers/net/wireless/ath/wil6210/fw.h +++ b/drivers/net/wireless/ath/wil6210/fw.h @@ -47,7 +47,7 @@ struct wil_fw_record_fill { /* type == wil_fw_type_fill */ * for informational purpose, data_size is @head.size from record header */ struct wil_fw_record_comment { /* type == wil_fw_type_comment */ - u8 data[0]; /* free-form data [data_size], see above */ + DECLARE_FLEX_ARRAY(u8, data); /* free-form data [data_size], see above */ } __packed; /* Comment header - common for all comment record types */ @@ -131,7 +131,7 @@ struct wil_fw_data_dwrite { * data_size is @head.size where @head is record header */ struct wil_fw_record_direct_write { /* type == wil_fw_type_direct_write */ - struct wil_fw_data_dwrite data[0]; + DECLARE_FLEX_ARRAY(struct wil_fw_data_dwrite, data); } __packed; /* verify condition: [@addr] & @mask == @value