From patchwork Mon Mar 6 20:59:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 65121 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2072355wrd; Mon, 6 Mar 2023 13:05:17 -0800 (PST) X-Google-Smtp-Source: AK7set9JRDGZQyvcLHtgT1O4OA7ixkGrA+uWD8qp3eZtS1TTpOO4YUo98Oy/isYfYxqajXCP2PBG X-Received: by 2002:a17:907:dab:b0:8ae:11ca:81de with SMTP id go43-20020a1709070dab00b008ae11ca81demr15116426ejc.34.1678136716913; Mon, 06 Mar 2023 13:05:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678136716; cv=none; d=google.com; s=arc-20160816; b=PV6n9aUtJc51lcfMT6SJwkzPq117KFjY1xkv7Hm4kWNitEH0dSNykPoKEcD7j8wFYR EgvwBrrPeuUQ7Z+ISOc5ls5vFy3LwBcHcZzKhb7i30RFdqFKyzbavIOqc28MljTrEuaS TEMSJ6ZQoidxTJ1Z4EDOb8lJoFIlOvu+N31f/wJzkD7kUF/nfJSNuH0DpEd+8QvNzL2I XucNKxBFP/MMTAgNAWEStZ/tpMkbEt/ClG7dHdKcXZVlVFDzSKvmcjLkvCuT4W4q/+VM cYdUpPNeumsvs6IVxNbQoR9FdiiBoqhLuMQv+EMKoTP/UVKeKajnQjVs0Qggc5htkmF8 50OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=J5gktnRkgHPSnPk7gkaPfS7CgdRQUTAWSpjq8uz2+tQ=; b=rozbyIaFc6wzqA/yfyPlAgKHP4gBOK5+kCQqA08M8Ggy+8FlwGUTQT9NdXkHS5u3lp 7xsnU8+dnQjB9g9BfsdplOgoxfJtV6oDvk1LM9w4EAFv+Yal9/EWFJKJNMyCyks0pQsJ GWAUAvuVoBRY+MFqcPnP9fEeN7FVxpVm3FeQKBaiQXX+eWXwGabJQvDGQ7KHMl2AE59L ppCSWLCaEj7oDGjMp7m+c1bMFZVUH7z+305fnHm8ukQROPT3eK5KZNIwkt9G6FSAkxv4 gqzTwx55OP5UEhLxM62qUzwOL0WC5YV/82Ls4lptNcn+Au+38C4xTARxFsgdIcxT/s91 Hf4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OfGFw8IV; 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 gb34-20020a170907962200b0091441646585si1506879ejc.843.2023.03.06.13.04.44; Mon, 06 Mar 2023 13:05:16 -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=OfGFw8IV; 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 S229757AbjCFU6l (ORCPT + 99 others); Mon, 6 Mar 2023 15:58:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbjCFU6j (ORCPT ); Mon, 6 Mar 2023 15:58:39 -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 76FFF39B94; Mon, 6 Mar 2023 12:58:37 -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 114DA6068F; Mon, 6 Mar 2023 20:58:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9D4FC433D2; Mon, 6 Mar 2023 20:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678136316; bh=FnI5yCjhAbwL9Z08M/gMwkBQvJQHwg7HlnK/1zcv8bY=; h=Date:From:To:Cc:Subject:From; b=OfGFw8IVDUl+/r9+w2wANHiGRk9SfNjqEFfoEpLqeEBo2IRb4wXiZanA4bzSQLvox eazCcCwBVyJvOwA+rWNkM2XCts1417psYxrG12wEWGh30yigjhhTX1dDejCMok97/b t6m/R37FvfEs8rh325X5CYsNfqddxqPjJSK4C2zQ8lJWnXeAEKunmdkX5eVd27XFcJ 5dn2Vq/XALccN2Urr1a2G8Z9Pmo0Ooj9W7zeQQZtNRIQIpgFxwdJtbxkQj7y3iHJJm q4kcJUDdoFjW/n3A2eIaKn1M4BvV7j5hGPRvrzucxW9c9YhzdB34FKGQ7FQPe9jdXm 1DktXw3ht/KFg== Date: Mon, 6 Mar 2023 14:59:04 -0600 From: "Gustavo A. R. Silva" To: Benson Leung , Guenter Roeck Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] platform/chrome: Replace fake flexible arrays with flexible-array member Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759653886344489007?= X-GMAIL-MSGID: =?utf-8?q?1759653886344489007?= Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead. Use the DECLARE_FLEX_ARRAY() helper macro to transform zero-length arrays in unions with flexible-array members. Address the following warning found with GCC-13 and -fstrict-flex-arrays=3 enabled: drivers/iio/accel/cros_ec_accel_legacy.c:66:46: warning: array subscript is outside array bounds of ‘struct ec_response_motion_sensor_data[0]’ [-Warray-bounds=] 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/21 Link: https://github.com/KSPP/linux/issues/193 Link: https://github.com/KSPP/linux/issues/262 Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] Signed-off-by: Gustavo A. R. Silva --- include/linux/platform_data/cros_ec_commands.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h index 7e9c76aedd2d..ab721cf13a98 100644 --- a/include/linux/platform_data/cros_ec_commands.h +++ b/include/linux/platform_data/cros_ec_commands.h @@ -2701,7 +2701,7 @@ struct ec_response_motion_sense { * Sensor data is truncated if response_max is too small * for holding all the data. */ - struct ec_response_motion_sensor_data sensor[0]; + DECLARE_FLEX_ARRAY(struct ec_response_motion_sensor_data, sensor); } dump; /* Used for MOTIONSENSE_CMD_INFO. */