From patchwork Mon Sep 26 21:47:25 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: 609334 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 E9762C6FA82 for ; Mon, 26 Sep 2022 21:47:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230120AbiIZVrk (ORCPT ); Mon, 26 Sep 2022 17:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230055AbiIZVri (ORCPT ); Mon, 26 Sep 2022 17:47:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74A21AE9DE; Mon, 26 Sep 2022 14:47:37 -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 0824E6147F; Mon, 26 Sep 2022 21:47:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43234C433D7; Mon, 26 Sep 2022 21:47:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664228856; bh=ctLhJppD55XlU1Ayb1sGbBYR3KPeJbjfX6+6mVLpJxQ=; h=Date:From:To:Cc:Subject:From; b=aF/iIgO7J82RcvVzbgUbO0FpQSzhrLOg/7udOApBEKaNNWwwzx9bswLeVpFfNxMYv +AQ7B/md82Yl27QCLLB5WtkToCPhIjbLBkRoohXNfRjIi+7ZspXouIU6rXD1XblOOk wTG8E3HKa3wNDeP1sXBMEGvD6CV4Ik5wfAzGZqNOD+cltJaJwJ1KoosievRFzB94S/ /d9SOpFaIb9C9TAjSz8iYrppLnXUwHGlEdqWniZYZiPQMhvrtDfImLwFEd3nMeijFS 1UluPBtf9ExYtcj610paZk/68Cl4sOZ+nzGIaagGJtkEktug3QwV45oBPeNOoVNyeV TI/9/F8YS0hHw== Date: Mon, 26 Sep 2022 16:47:25 -0500 From: "Gustavo A. R. Silva" To: Wolfram Sang , Mika Westerberg Cc: linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] i2c: acpi: 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-acpi@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/218 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook --- drivers/i2c/i2c-core-acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index 08b561f0709d..da6568a20177 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -26,7 +26,7 @@ struct gsb_buffer { union { u16 wdata; u8 bdata; - u8 data[0]; + DECLARE_FLEX_ARRAY(u8, data); }; } __packed;