Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3971747pxb; Tue, 25 Jan 2022 00:19:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7MRdnqE44+CRTNL9iJ5te4hWNywN8ElGQo7AkMMYC63k3d0xvdSyLZqLO/KxFGdPwNGY2 X-Received: by 2002:a17:902:6bc9:b0:149:b7bf:9b33 with SMTP id m9-20020a1709026bc900b00149b7bf9b33mr18097790plt.18.1643098751186; Tue, 25 Jan 2022 00:19:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643098751; cv=none; d=google.com; s=arc-20160816; b=bnKLHEJJWo+rOoaReFBobuHbQ1b87QhOVvDxNlX/zs6xgoi81eMHYms3YAteuMuiKN rF5ztj7inB2EOZqD8LbRqICDDYFptr7+Oo7UHNgNzQag0TXvKLLeQKjay6ijs6H5x/Ik oHDVjSRtxSWOu7/NP6SSodpfnaUxVbEJnv92+4ogkySI+EHyJJCS49lA3zEfd02hI9Uk 9SMiMhMydu1+SrBwoU62J/MnbzeU4RoN3SdHptaXDCHlMFCM/IZpRsSXmR7Ufrv2DkAM xJuIe0AON/I9/KCxSdgz7ycv6Cp3gtT/5esG8cMEjPmBIHyr67eMKbCbyFOXoRyUQWw7 qonQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jBVLDd1vxSKMRfBv/1f8X9SiduUPP8Kfnrf2SHJ9GEY=; b=dBox+si5gFPuhUVzghl+t8Cj4Xl1DmeFL322Uo2pDkg51DzepkDU0U7B1H/h2TzOqd bUZ/fqmO8gO2VId2rB1LsPuoJkn3jgVc3vzeCZCcsVBKiGSxAO1Fo5J0BP5RvWrUX3xA gExNuL0ikB8OUxG8n0eejEsxYpfbQvsV7gotfi0NAXtWF6fd0utyh+M53N5yVbyHo4Bh UNPnPWHZQWFqJliKdrpFoLcIsATZ7Orfee7M2ueFHQbM4R9BHu2L/UIBsq3DFm6d+RI6 ocaWlt3HrIzGZL4U8DK43W4RfEOcvDCHb/ZEZA+8hrABydoP+0b9/8b8vnXv2E9Rv9RM O9rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KBJp4gea; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i184si8148694pge.4.2022.01.25.00.18.57; Tue, 25 Jan 2022 00:19:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KBJp4gea; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413224AbiAYAii (ORCPT + 99 others); Mon, 24 Jan 2022 19:38:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2364663AbiAXXsq (ORCPT ); Mon, 24 Jan 2022 18:48:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6853C0419C7; Mon, 24 Jan 2022 13:43:55 -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 67C5061502; Mon, 24 Jan 2022 21:43:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28B8DC340E4; Mon, 24 Jan 2022 21:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060634; bh=dKelhVWUvz4ApohNdesXTvFVNa5aDTyUP3bnUOpRi+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KBJp4gea+PDzTs9nJF/widWMElGhbfQikLF0ki5vMyMtevaoxmI8PhTHmZNydpg8f xkyqMWnsmfI+NSHYt+zAUvPoWLYtb8WGMQTLWWti0zASb1oMkH1WHwSGPjPToSRbir SXBAXDwEZxLx3FGXmkZwv42J1fMNcbs0iRG/8uyY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , "Gustavo A. R. Silva" , Alexandre Belloni Subject: [PATCH 5.16 0980/1039] rtc: Move variable into switch case statement Date: Mon, 24 Jan 2022 19:46:09 +0100 Message-Id: <20220124184158.226111508@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook commit ba52eac083e1598e748811ff58d259f77e4c5c4d upstream. 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/rtc/dev.c: In function 'rtc_dev_ioctl': drivers/rtc/dev.c:394:30: warning: statement will never be executed [-Wswitch-unreachable] 394 | long offset; | ^~~~~~ Fixes: 6a8af1b6568a ("rtc: add parameter ioctl") Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20211209043915.1378393-1-keescook@chromium.org Signed-off-by: Greg Kroah-Hartman --- drivers/rtc/dev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/rtc/dev.c +++ b/drivers/rtc/dev.c @@ -391,14 +391,14 @@ static long rtc_dev_ioctl(struct file *f } switch(param.param) { - long offset; case RTC_PARAM_FEATURES: if (param.index != 0) err = -EINVAL; param.uvalue = rtc->features[0]; break; - case RTC_PARAM_CORRECTION: + case RTC_PARAM_CORRECTION: { + long offset; mutex_unlock(&rtc->ops_lock); if (param.index != 0) return -EINVAL; @@ -407,7 +407,7 @@ static long rtc_dev_ioctl(struct file *f if (err == 0) param.svalue = offset; break; - + } default: if (rtc->ops->param_get) err = rtc->ops->param_get(rtc->dev.parent, ¶m);