Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp99597iof; Sun, 5 Jun 2022 22:21:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGMo+AGch+mS1SuuQ8goBH42J43qimDAEvgNUQqTjyZGiouNeCUG1Xgm0o0Ojh8FQ9ifsB X-Received: by 2002:a17:90a:8592:b0:1dd:bab:d286 with SMTP id m18-20020a17090a859200b001dd0babd286mr24633979pjn.143.1654492859946; Sun, 05 Jun 2022 22:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654492859; cv=none; d=google.com; s=arc-20160816; b=f/+/tP5Sfws6HWCg3160G18f4oGkyYfQDHU1gupnb8er9Q2V1UPXtOZFzxEf0ioz77 6nVREl371ztZdB+1XvHgmd95mOJpRHmJ53nJuV+OLgBhVSRQ/ktNb0Di37KeEMzSB/Vq hMoe/y8PlfXgnK1m1diP2DS0ifuNT32Y8YnIt0FML3v3MLHl3ndHGhxZGL+qpn9TcFMH p+JsOXKx9nRJHhe00qiW+QSTZGfSCYjnJgNjjzkzDrvI/8J3PANrPqGrFKXg9GtcYyh7 XpUeYuAfYmXyZcMZ0mND6Xlsta/KJ1NhUs5gz1ybiCJPfjaegKZyQT6QoqBBIkdeecRh efVw== 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=DfT/k88UiG2UAzMtBciXPlpGW45bLOztkxGwyJUArkk=; b=WUW4GMUsN8K07PKbEGp/Z9ROfqo+fqOU8BLCD78kzZTfLbORgTWEkCTFc3SBKK3Ycd 4uDGv+YIdGPs57C1xcQBW++rI1o9lstIXuP3BZgWu8Cgk+k1CJl/ExBKlgNyr7z94IKO SJWC2/jjJs8rjr48Qgg71XdCx3CJ12Ryh3vOrzj5NY6qe6JCZJBtD00isSLLmV7p42kp 6+bYKZ5L0AB06JRIOzEGX9fX+3G0s4tJ61Cgd4aa7n1NUqcTsT6ISTuMndaVCyJyBkFB CnZpUkoang31t3Kt1da/nC2G9XBqhQVwdWqBfc/P5Xi4XC+d7x98QdfgLjqX5+NQY7LM 7tAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yk8WJN2f; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id j9-20020a170903024900b00161f6d845easi21173579plh.229.2022.06.05.22.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:20:59 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yk8WJN2f; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 9505220FC6A; Sun, 5 Jun 2022 21:31:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345294AbiFCRsk (ORCPT + 99 others); Fri, 3 Jun 2022 13:48:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345237AbiFCRsJ (ORCPT ); Fri, 3 Jun 2022 13:48:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3CBE54029; Fri, 3 Jun 2022 10:44:52 -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 2DA4761B38; Fri, 3 Jun 2022 17:44:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29A56C385A9; Fri, 3 Jun 2022 17:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654278289; bh=X+TGgT1zSmpB0nRebXLItJ/4nmBeSj1ttQzmYio8cEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yk8WJN2fgDlkBhBiEmAw73EbPhWdG47WlnhwHqxesb7HizFUjlTWwLEZwByWzmbbb c6sKnpStkRf9P07BwOmhR+/4lNcbIc+ehEfBsvKfnCjEIi19j/FSw62YXFVYqQWkp5 zKCnK4SeOQkeHGy4ZPh+pMRqOgOfeNrJ1Elor0d0= 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.4 18/34] drm/i915: Fix -Wstringop-overflow warning in call to intel_read_wm_latency() Date: Fri, 3 Jun 2022 19:43:14 +0200 Message-Id: <20220603173816.524059323@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603173815.990072516@linuxfoundation.org> References: <20220603173815.990072516@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 @@ -2822,7 +2822,7 @@ hsw_compute_linetime_wm(const struct int } static void intel_read_wm_latency(struct drm_i915_private *dev_priv, - u16 wm[8]) + u16 wm[]) { struct intel_uncore *uncore = &dev_priv->uncore;