From patchwork Mon Sep 26 23:01:08 2022 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: 12989517 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46F06C07E9D for ; Mon, 26 Sep 2022 23:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230203AbiIZXBS (ORCPT ); Mon, 26 Sep 2022 19:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229779AbiIZXBQ (ORCPT ); Mon, 26 Sep 2022 19:01:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B415EA5C6B; Mon, 26 Sep 2022 16:01:15 -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 ams.source.kernel.org (Postfix) with ESMTPS id 5DB01B815C6; Mon, 26 Sep 2022 23:01:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7653C433D6; Mon, 26 Sep 2022 23:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664233273; bh=DP2/l6tR4P/DfoghYnDGEAWd4w5n5Txnre0toNJR3B4=; h=Date:From:To:Cc:Subject:From; b=boCq+yQ/8137uehBc9l2Vg8fH0UtZiV/BTfOw5Pliv/p3ReaZul1LbHdkZ+kETELP JNMJXaw65cWY5KBy57F76JdC3PVvqn2eIjIkHrb9fwZu66N6hzDL43oFrkW7rs8Ky+ XFvTUKOsJ/xYtApAUBZwwy8czhvK7ZpUpRi1GMxzOGBM2OQnZqfMPvpeIfiRCmBSxI Ss46Z0hBLn19YxHSK8RzCQzZv0aORaqH9vU3oF9ovqM+UbH+C26QcIyf8wh6hGS6Pc w9q9ccZKPDVw6ohQhzAawjdDPWFItsVzVAjSue4yW7udf+9Fk9uOobqGkEK7FtFfcX clIFfgYpsQdng== Date: Mon, 26 Sep 2022 18:01:08 -0500 From: "Gustavo A. R. Silva" To: Andy Gross , Bjorn Andersson , Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] soc: qcom: smd-rpm: Replace zero-length array with DECLARE_FLEX_ARRAY() helper Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro. This helper allows for flexible-array members in unions. Link: https://github.com/KSPP/linux/issues/193 Link: https://github.com/KSPP/linux/issues/224 Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook --- drivers/soc/qcom/smd-rpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/qcom/smd-rpm.c b/drivers/soc/qcom/smd-rpm.c index 413f9f4ae9cd..125cb456a5dc 100644 --- a/drivers/soc/qcom/smd-rpm.c +++ b/drivers/soc/qcom/smd-rpm.c @@ -75,7 +75,7 @@ struct qcom_rpm_message { __le32 length; union { __le32 msg_id; - u8 message[0]; + DECLARE_FLEX_ARRAY(u8, message); }; };