Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp104337iof; Sun, 5 Jun 2022 22:30:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu1H4InhzJRIQucpem8yow2syof0HTMlriAij/n09Cd0nbTVD+p8yqyTSc99ECZpHEftnq X-Received: by 2002:a17:90b:3696:b0:1e6:6f6d:962b with SMTP id mj22-20020a17090b369600b001e66f6d962bmr26593494pjb.8.1654493425883; Sun, 05 Jun 2022 22:30:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654493425; cv=none; d=google.com; s=arc-20160816; b=0rLtp5SXrKQBOoJya5f8JAlgBJv1jAbXRpj1WerMtnN04h9jn//3kBdwHYooygTG29 eSQXvWMk3skKK059/3x9gpEtBacPbjyb33zrt1KeVW0XB2Jq2catLfXG1S3uQ7eL6i6t BQCUa75ani0dCQ7rA0fSw+GB6smAp+z1NRyepO1Zj2kP/zkYrUCFdrsB+REmOw0BEziF L91beKrarh/lUwcS9N4ToVsULoUuD6H/XP2GpfRxmolftgaMU21GqAWn5tUKse/DVuLY AfqonGRpX8tsjHkF4J6KOuiXxWypKbc8zfNX3F7HMyOzMTnXGLipJ3NJTY28iP0Cgopg +s/A== 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=x+z2NdaV6LNwEr0iJSWvuHlSHEJm9xC8ELhXTDiWUSA=; b=XgvtoZtMo10uKWfF4g59fA2jcEM+KNh2FEeT2HMLEqwbx0gUuJouirdZgkXRqab8TB p2M1ZFersD926Y3XV2AuwYxy6E62IYyp0iXwgsOhg+IeXwad77QG0IoW99aP3QmSesI+ yqqVTzTirGxzdFTurilKtVgEi8vyUf+1z88JWdfqR9CjKLjkh9ViMFdi3i2y8SkVjmwa O54u17lvYm6VD9aNxaNiue4HlH3nRJL/dIQ3cXGaLD1vkZk7aELKwFVe9GLY+2O0wkc2 +C6m3NVk5F7TdRvkCP+B7TyBTM+Rybaz+FMeEIsOHTmt2lQXqUntBPRVbBl4lKpaGonb 0chg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KLlSZ04N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j189-20020a6380c6000000b003fce1c18cf9si14341951pgd.213.2022.06.05.22.30.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:30:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KLlSZ04N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C3666615A; Sun, 5 Jun 2022 21:30:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345831AbiFCR4o (ORCPT + 99 others); Fri, 3 Jun 2022 13:56:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346422AbiFCRvJ (ORCPT ); Fri, 3 Jun 2022 13:51:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7550F53726; Fri, 3 Jun 2022 10:48:07 -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 112DF60F3B; Fri, 3 Jun 2022 17:48:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F35C2C385A9; Fri, 3 Jun 2022 17:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654278486; bh=gdpuj4BS15+mxIcnIpId4JL7JAXR0GkknTGFgebL6Zc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLlSZ04NARNLGJRHnV+EvnjiBUTD3nLo4s+22NtuHB+G7bTjTk/0UbPYK4UHJcLGJ ExAXib+B17y5CHMw0FmfCMAh7p8x4gXmFfRlGHYEZCP9hKoS6+E21Xmo3F94HdnC+o fQn0PBaWnP/ybcx4voE6iBFXlSrcEP6l1WbC9ZlM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH 5.10 21/53] drm/i915: Fix -Wstringop-overflow warning in call to intel_read_wm_latency() Date: Fri, 3 Jun 2022 19:43:06 +0200 Message-Id: <20220603173819.341399118@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603173818.716010877@linuxfoundation.org> References: <20220603173818.716010877@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Gustavo A. R. Silva commit 336feb502a715909a8136eb6a62a83d7268a353b upstream. Fix the following -Wstringop-overflow warnings when building with GCC-11: drivers/gpu/drm/i915/intel_pm.c:3106:9: warning: ‘intel_read_wm_latency’ accessing 16 bytes in a region of size 10 [-Wstringop-overflow=] 3106 | intel_read_wm_latency(dev_priv, dev_priv->wm.pri_latency); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/intel_pm.c:3106:9: note: referencing argument 2 of type ‘u16 *’ {aka ‘short unsigned int *’} drivers/gpu/drm/i915/intel_pm.c:2861:13: note: in a call to function ‘intel_read_wm_latency’ 2861 | static void intel_read_wm_latency(struct drm_i915_private *dev_priv, | ^~~~~~~~~~~~~~~~~~~~~ by removing the over-specified array size from the argument declarations. It seems that this code is actually safe because the size of the array depends on the hardware generation, and the function checks for that. Notice that wm can be an array of 5 elements: drivers/gpu/drm/i915/intel_pm.c:3109: intel_read_wm_latency(dev_priv, dev_priv->wm.pri_latency); or an array of 8 elements: drivers/gpu/drm/i915/intel_pm.c:3131: intel_read_wm_latency(dev_priv, dev_priv->wm.skl_latency); and the compiler legitimately complains about that. This helps with the ongoing efforts to globally enable -Wstringop-overflow. Link: https://github.com/KSPP/linux/issues/181 Signed-off-by: Gustavo A. R. Silva Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -2846,7 +2846,7 @@ static void ilk_compute_wm_level(const s } static void intel_read_wm_latency(struct drm_i915_private *dev_priv, - u16 wm[8]) + u16 wm[]) { struct intel_uncore *uncore = &dev_priv->uncore;