From patchwork Mon Sep 26 21:48:21 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: 609456 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 A1F88C6FA8E for ; Mon, 26 Sep 2022 21:48:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230106AbiIZVsg (ORCPT ); Mon, 26 Sep 2022 17:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230055AbiIZVs3 (ORCPT ); Mon, 26 Sep 2022 17:48:29 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 017B2A6ADE; Mon, 26 Sep 2022 14:48:29 -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 sin.source.kernel.org (Postfix) with ESMTPS id 6DB68CE13C2; Mon, 26 Sep 2022 21:48:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B5ACC433D6; Mon, 26 Sep 2022 21:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664228905; bh=6W0fTeqRvfZnXUSIy2HmwaotV8quNId5t2aiRo7yB4o=; h=Date:From:To:Cc:Subject:From; b=IAMPRMpxF9lO2m+gOdRH1PFJCIdOlIer2cgOdeuDYjBvSpHIU91+gOygNyaH9XPQf k2R2pgi+tF9AbQncVVy3OzTAZ6amCRyZy1wrA+PGymZ1pPKlPefV1k1tr/ZQikTs97 k9d0LaHckKkPVfp/THqd42E1Op1kMg36WCV33wpZV2py1MPAWlbFLJV7fDtGBgkT6W sKpxfYoZYegc3g/lbZ2ZT3sDZzuBMulq1iTUsJli2TDy7M9HdGFnrAoVpFH7xFcR60 epAOrBn+UDbQD7LGfAxeiGLyqDiyubL8Z3cMABErGATuUKICwXVR058Q8x2hm5IOiP WbNCp/8rZpn7g== Date: Mon, 26 Sep 2022 16:48:21 -0500 From: "Gustavo A. R. Silva" To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] Input: applespi - 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-input@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/219 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook --- drivers/input/keyboard/applespi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c index fab5473ae5da..91a9810f6980 100644 --- a/drivers/input/keyboard/applespi.c +++ b/drivers/input/keyboard/applespi.c @@ -311,7 +311,7 @@ struct message { struct command_protocol_mt_init init_mt_command; struct command_protocol_capsl capsl_command; struct command_protocol_bl bl_command; - u8 data[0]; + DECLARE_FLEX_ARRAY(u8, data); }; };