Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4592368pxb; Sat, 12 Feb 2022 10:24:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3PIA7V4yJJkr8VUTm1i8LxUga5dnwue9wT1BxbGW16Isl+XDj2xQxAKjjfXhLCKQf+XSC X-Received: by 2002:a17:906:65c5:: with SMTP id z5mr5451387ejn.439.1644690259196; Sat, 12 Feb 2022 10:24:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644690259; cv=none; d=google.com; s=arc-20160816; b=uLxVfvR9JAfsEOEvEZ73txE7bKOvU8FHgaI6pcB5Avic9zYdy5tvg7QOp9H8oaogg+ dPeCRtw+MmwNbMV4TV9t47Sp+XPR4n6Y77PC2c/xIoB97SafokTMassL0IkkN5j0qWnB KbEvDCzqNxWx/IfylrtIR6ZiP4ZXRKnChXWuurhRukSs8YtUPytuLdZ91zRGwGLjXPer AZxIW1YjvrXnniObn31KcaFU434+WuNL13zFCvPB3T/FZ9VL1alqOSHJrd5ZUONpHr1h 1WgrZTnLKgIXAXjRyvkpQKhPDBGaR0cdRgzqrLzVB7zp0dVGsqwtrA22XS+bVG/KTuOk VVwQ== 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=o0up0HVCa5+HmvuyfwLG1vSs6aTX1vBb9BMbCGAtELQ=; b=zFRnsROrWUgwF7PVYfbmd7ucMCQbEt6ZrAIkoeNve6pSC+wuVzM90qwjNQ8REVeAKt 8giO2muAyak5qqHh0iAPJyGGcQlgJ3cE3CsDvJzxbBL/uPaIIXI4FubuWpRWLzZ6n07T SbsEkImY9XXlHgDyk98oGtwHFN9Psv7B8uq2YFe5gVc556HvjiM2nunlKuBj4TccJhbd vntFFKQbx+EpiqUjbItOeRYQgaiWbKQh0v0TFZJdpSXtsKkQZTDH3pvohQVfWi8l6jyk CnQ1JRGaI5cvi9aelD7IsCGyMqNHYnCIJ1cfbO/cN4vz6HarGIdvnVTTPaSGVh4aD/Jx dzdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HjXOiKox; 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 hp3si20122056ejc.847.2022.02.12.10.23.55; Sat, 12 Feb 2022 10:24:19 -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=HjXOiKox; 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 S1344052AbiBJTjy (ORCPT + 95 others); Thu, 10 Feb 2022 14:39:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344029AbiBJTjw (ORCPT ); Thu, 10 Feb 2022 14:39:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7233AD66; Thu, 10 Feb 2022 11:39:53 -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 EE666616E2; Thu, 10 Feb 2022 19:39:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57062C340EB; Thu, 10 Feb 2022 19:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644521992; bh=MCUDen9JpjaHMTO+n5Axj6eiZjr+zQPk9bws+uU+69Y=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HjXOiKox0wwCaPR2wv0irMDL0H0Us/wf6AV/YuSoDS8lzy0zZIpWGJFvFIX+wKjtM HVmKq7RgF3JVeJRGs+lccEOwkes2a/p8G6Mvd9b2HX7nCTRbjmoEVfLysAdlsu7pmZ 8BQwUlkzf8Le67ibq13z+mnZlCCJWyvAvPrAjwZEpVWE9RtNPtW1l8Sot5R0DcfxRg HFwl4+dtIUWzWIihTR8a8RdUj3UQzir6Juk37lxAjYlIehR/S/dBj5fdaH9utrXCa5 3tJsWqMM9CJOCOulRAveDvES/0xxbaeY0wh7EowHRFILpP8YqIc4SwvX7QQRUn1ErN 8yH+hv0tFydYQ== Received: by mail-wr1-f44.google.com with SMTP id d27so11427082wrc.6; Thu, 10 Feb 2022 11:39:52 -0800 (PST) X-Gm-Message-State: AOAM532bhQflBHkylT2oQVrDHTP1OwIhmR/Fbo2i0zlM5hD35Jyr75cK IxUVtTe6pedDHMFAkVCiEt49SyVma2FsqXPxhck= X-Received: by 2002:adf:9123:: with SMTP id j32mr7507533wrj.189.1644521990682; Thu, 10 Feb 2022 11:39:50 -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:39:39 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] ACPI/IORT: Fix GCC 12 warning To: Victor Erminpour , Kees Cook 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 On Thu, 10 Feb 2022 at 20:29, Ard Biesheuvel wrote: > > (cc Kees) > ... for real this time :-) > 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.