Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp7971629ioo; Fri, 3 Jun 2022 18:34:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAHc229qtSp2T5n4kk2InarGHBHtDoYo6DJMzSy08Pudx3P3MdLs0UbpWJmeTN9v5CpSMv X-Received: by 2002:a05:6402:5168:b0:42d:d3f6:2a1b with SMTP id d8-20020a056402516800b0042dd3f62a1bmr13622779ede.94.1654306448088; Fri, 03 Jun 2022 18:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654306448; cv=none; d=google.com; s=arc-20160816; b=Hrp+5xFVEUnahHYFN1zdjPqoG4n69mZRnOQrT9KndO668at+2mL1YPH2RYL7tocBBm P8Dt1XE/74FogGi3CjN6jSkrJhplzrTBWGSfVrLybk6UgMEYT9ZOIo0GnlU/hlokrL28 kKlgv3p/PNe628ljZ5hf0pHxyHKVIxLDloA9b05j4WyN4IA62ACQxpjPmm6G1p8Gwfba 1UGnSGEIIICRI5t42tXq5rsE0akbZ66oyQOv7D2zx4vG/pfUBkyB55FjW5CTco/mSQ05 wfbi5O1rUpDYObyLq/XWlemTiA9nt7q5eW+3mM6VVfg/Wkx3O1FfYKLSc7itrqLU6nQB 4jPw== 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=S27ZteiCy2lMY44z7VB8R0SZuOreN5Uktj5DZcbUmrw=; b=gTv1ofD+OgcNEalVmw6eA+mFZdsaDP4UhPCEIYXlci7eS/kBV5xfeH+tFgDiQo4uej kJzFFH7utDjJWE2VU06NIjpEXOrDhUwTvXnyOT6vCFpa6qxeO5mc7CREHB39MIdkhYPL kAEbt9ezsQSGaFsH6TdWYBPEhgxktYplwJaPZHqFam1MSJiMfHVAYXhGE9O1CO9voFKl zPJhGuNLH2zk0uI0ceJFvLTN65/pVDzgndxraIQb6d/cKxcYzTl7qmTPeWelEuRE5WGV bt3mcxkIuEmeYPmcr5Xku/RGrsZKP9VUispY/uQRyq1a3S9iB9EQBQ7FmLeN3ilK+q/i o4mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="AUue1vL/"; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ca27-20020aa7cd7b000000b0042ae7984dcasi8615817edb.58.2022.06.03.18.33.39; Fri, 03 Jun 2022 18:34:08 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b="AUue1vL/"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344936AbiFCRn5 (ORCPT + 99 others); Fri, 3 Jun 2022 13:43:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240604AbiFCRni (ORCPT ); Fri, 3 Jun 2022 13:43:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B00554019; Fri, 3 Jun 2022 10:42:00 -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 97E3961AFD; Fri, 3 Jun 2022 17:41:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7735C385A9; Fri, 3 Jun 2022 17:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654278119; bh=lD/i58mJ1mzC0KR7f+afWNEDoc7pInkWcARBKYxsdxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AUue1vL/BQpj1XszhTlwhozgFGlVOE7B32QtHefLOI9/cmXzmMysskx6WZ1Wk6s/f TNipghOMy3PXK2IZLWubRiXaepGlV4mwqTN65l7kLuvB4uLDXKk0qzpvN0FyaXTJcz vk62u1tGwdzKf7OfDUK+d4s1uw8GQQKGZyDiMh0o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH 4.19 16/30] drm/i915: Fix -Wstringop-overflow warning in call to intel_read_wm_latency() Date: Fri, 3 Jun 2022 19:39:44 +0200 Message-Id: <20220603173815.574880171@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603173815.088143764@linuxfoundation.org> References: <20220603173815.088143764@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=-7.7 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 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 @@ -2814,7 +2814,7 @@ hsw_compute_linetime_wm(const struct int } static void intel_read_wm_latency(struct drm_i915_private *dev_priv, - uint16_t wm[8]) + uint16_t wm[]) { if (INTEL_GEN(dev_priv) >= 9) { uint32_t val;