Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3150062pxb; Thu, 10 Feb 2022 13:34:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwSEAfB9PzhNIY1MBTcnqxbconbBQmtn+pCJNGkuYIajLcvFVWLByACJJSyZn0qotcrurEY X-Received: by 2002:a17:907:3e13:: with SMTP id hp19mr8374603ejc.362.1644528870271; Thu, 10 Feb 2022 13:34:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644528870; cv=none; d=google.com; s=arc-20160816; b=xi7VvH+r8/85Nz7MR8qD1lOdjcKZjWHs7+oZnZcaYDzrN/WpshrYWIyr7fT677Q4F0 up/rj9uvkPL3VCLDwDsT70HycD5LFp9ge5bxyfBWkTbKCJqH4fpVKfqI6+aQJQ/SWenA PaRH74U/2iHf3Q3ylw+uGlVvB6FNFYhw3OcFAQkEA7yQWc3LJtEAEDzT6+BX1r4rQD4T CImOZ7j4EbSfXSpPgQGtQecl4WUc8ETGAAZ6zJouosZ1swyJQv6BPZX2JSS+bhedZ6uE tKUnf9VWf/cdewO3Qrdq8h/Xslwd0Vx+RHPeFWY/a7YhjZBeXMhU7bIoOJxbU09Sb4lc sBTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sIJEHCp7ErFe7HSokIi1nmjO88sSb0JZ82C8k3WIHu4=; b=mD1GYsVMVjJUurVnflNcKt0vK/LWUDsl4ccSbiholsb2rrokHvRb49JOP9EHG5k7It 7wJLx0+hYqYKbOknYWAN0ceBKykoN77Fzp0sSADt3baEQXABQKMQMMimQoK68Kd/jsu/ OWXPH/UKDmqk7ob47zivO7Uvw4UtarvSs8GzgyG+BloYHqLtgW5TcCnizDT2Nm08TfOf LNuiAZDXa39fD25cMAEAdz9ewdkqCwVQMnNNDrW3syht/zNxgw2T7BnhabpC1bR21jZl 54rm4GDATZI5T0SrvGTj6jKKmpLd/NVVGfMUQtk9yr3W2unXaDV9JHsFiewWryI5HtNh JHaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MNB9qls7; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd2si16615901ejc.882.2022.02.10.13.34.05; Thu, 10 Feb 2022 13:34:30 -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=MNB9qls7; 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 S1344015AbiBJT33 (ORCPT + 99 others); Thu, 10 Feb 2022 14:29:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241448AbiBJT32 (ORCPT ); Thu, 10 Feb 2022 14:29:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB89BD62; Thu, 10 Feb 2022 11:29:28 -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 ams.source.kernel.org (Postfix) with ESMTPS id 92DD0B8272A; Thu, 10 Feb 2022 19:29:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33503C340F1; Thu, 10 Feb 2022 19:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644521366; bh=KsJk+ps9W2hgAdwcaKMeGyDBTMYmji5RSjy28va9Oi4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=MNB9qls7slFwlX6Q4IqR9XasLSWt5g1EEqHQqYRhYn/M9DvWCy/BGgMvVYlEbrE8z rbodVNPPsW623dL2IxQ2ipqwIunjutpmVh5LYTwVb0JukV0cywpmaV7L/i+NPD4Gyg VvpZ+dZrehYnjzZH70sN9rmcQpEmW0V0vJ1TfiwsJKhv7IbT5JpCN7CdNcNKORVF5I hMD2sUgOi61mugwawgLB7PwF8bCPARMLYNwbzQRf6LmGD/uLtJeSx3BAMkCC6RId7C BEkHpD0rLVqKm1df1+g9ux4X+pqjYgPom2dGGiRmbsvdgqY/WRo7bEdNhDjicxCCPn kjoBSRREmIoCg== Received: by mail-wm1-f53.google.com with SMTP id x3-20020a05600c21c300b0037c01ad715bso1624900wmj.2; Thu, 10 Feb 2022 11:29:26 -0800 (PST) X-Gm-Message-State: AOAM5337wa2Gtj5xF9ky7L5a84HaOg/VEJC3Wj1PAmL2btYshp/cRnXA LUXYQ075XDOFG5a5c8HSwr8MmTRzzvyAaEvVAb0= X-Received: by 2002:a7b:c5d1:: with SMTP id n17mr3429440wmk.32.1644521364469; Thu, 10 Feb 2022 11:29:24 -0800 (PST) MIME-Version: 1.0 References: <1644453141-1181-1-git-send-email-victor.erminpour@oracle.com> In-Reply-To: From: Ard Biesheuvel Date: Thu, 10 Feb 2022 20:29:12 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] ACPI/IORT: Fix GCC 12 warning To: Victor Erminpour Cc: Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List , Linux ARM , Linux Kernel Mailing List , trivial@kernel.org, Robin Murphy Content-Type: text/plain; charset="UTF-8" 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 (cc Kees) On Thu, 10 Feb 2022 at 18:36, Victor Erminpour wrote: > > > On 2/10/22 1:11 AM, Ard Biesheuvel wrote: > > On Thu, 10 Feb 2022 at 01:34, Victor Erminpour > > wrote: > >> When building with automatic stack variable initialization, GCC 12 > >> complains about variables defined outside of switch case statements. > >> Move the variable into the case that uses it, which silences the warning: > >> > >> ./drivers/acpi/arm64/iort.c:1670:59: error: statement will never be executed [-Werror=switch-unreachable] > >> 1670 | struct acpi_iort_named_component *ncomp; > >> | ^~~~~ > >> > >> Signed-off-by: Victor Erminpour > > GCC 12 is not released yet, and this is clearly a compiler bug (a > > declaration is not a statement, and the hidden offending statement > > [the zero-init] is emitted by the compiler itself), so please report > > this to the GCC folks instead. > > Hi Ard, > > Thanks for the reply. > This fix is similar to the following commits that have been integrated > upstream: > https://lore.kernel.org/linux-hardening/20211209043456.1377875-1-keescook@chromium.org/ > https://lore.kernel.org/linux-hardening/20211209043915.1378393-1-keescook@chromium.org/ > If GCC 12 rejects valid C with this feature enabled, the compiler is broken and needs to be fixed. Papering over this by making changes to perfectly valid C code is a slippery slope that we should avoid. Since GCC 12 is not released yet, there is time to get this fixed properly. > You're not obligated to integrate this commit, Why, thank you :-) > but you may run into this > issue once > upstream starts using GCC 12 (or a patched version of GCC 11 in my case) > with the > CONFIG_INIT_STACK_ALL_ZERO option enabled. > Yes, that part was perfectly clear.