Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp69772iof; Sun, 5 Jun 2022 21:24:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB8f/gULIR51a0VtWpk1CAA7JKpxrZRUX10VuVWdodRPGObFYakt88SlKaAY11CsyCxc6U X-Received: by 2002:a17:903:c3:b0:163:bfde:eec3 with SMTP id x3-20020a17090300c300b00163bfdeeec3mr22713738plc.152.1654489455107; Sun, 05 Jun 2022 21:24:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654489455; cv=none; d=google.com; s=arc-20160816; b=KKLoT9AF5A2A9GKyf57mIwB7znHS31Eeh7lURMo7gdjDeofZ0DntDwvfvYCznAyBrw qSwsmeceAP/VMyDWEC0i7ZyqFlMAkW/9V7Vnp6Ym7yL2wXTJDoDZn8csji/xvSupz+jQ 13sj+0CF9erNfG8+p0vs+gmKIFMU8zTmSV59tYwIcTDfkXgcpJvTUNDGhjcFc7mAdqoJ Bf+rH/vTLZEIBw7pnd5w/kkIT0Lqk2s+/mXoiyz63dadr6DOPBVEIxnxRLL4edrARQUU f2Dl++5Vc7XapllXQljSHtzAYL5QHjQcWATpDlJ07GFFKoFHL/dUUIVVXkSZl0ai6lH/ 1IBQ== 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=novRo21c6NZPHT7Yayyt8MathmitD32soH1BHtWJMgk=; b=RlYjbcDWzHl8Nq9fHHL+5Npcfw3TKtk2jw11TzvUTbSm+nm4igOXbuwwFjfojCbi1W yrRkPw9ShJ1vVS/zf1N+pHPWNopANw/7+oX9ZiLaJgGzy8VpH4cNK9kDT4Wf0X5+1mWA LZWYtRGEeaglzZbMMtNIeNxfcC3NMhnRu25TTTEHFomIiMWw9j4IdtXbtHBVC0NaiY5O 8JXtWGg8fxbpygtNPxgxgpZ0Ysvc2DIkYZR02SMpYI0rSShIupBrxA1SjH32CHwFEdMA 2vsFRJIVeYDW14v7+U5pVtj26dktY0oODB2gEYCyrbzjUtOp+kMDBFMuTE6lbUGCq+zC efEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hn9lMDPh; 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 n8-20020a170902d2c800b00153be6474c2si14432729plc.531.2022.06.05.21.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 21:24:15 -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=hn9lMDPh; 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 0708393983; Sun, 5 Jun 2022 20:56:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243483AbiFCRlJ (ORCPT + 99 others); Fri, 3 Jun 2022 13:41:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344708AbiFCRkf (ORCPT ); Fri, 3 Jun 2022 13:40:35 -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 2E7D153A4E; Fri, 3 Jun 2022 10:40:32 -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 ADE5761AE9; Fri, 3 Jun 2022 17:40:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF3EDC385A9; Fri, 3 Jun 2022 17:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654278031; bh=bqXp61k5CiwTWKkWEi6iswvZK06vWgdHmhXGjp6f8uQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hn9lMDPhw0wEhXU+htDVO7Rgo26Ugaw9GbH7LZB6MFwOyK4Q9vEVrvSg8KkIewcWj 0YiFarTVyeCw7eUORhQvsWzCbqymwStvfrqzcQTmMjd2TfWQlQb00cy03CbSCjVURq 4hT1JtU2AY49uncuAp02zsspYk2dH3tAsL/aGGo8= 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.14 11/23] drm/i915: Fix -Wstringop-overflow warning in call to intel_read_wm_latency() Date: Fri, 3 Jun 2022 19:39:38 +0200 Message-Id: <20220603173814.710422047@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603173814.362515009@linuxfoundation.org> References: <20220603173814.362515009@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 @@ -2793,7 +2793,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;