Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp97188iof; Sun, 5 Jun 2022 22:16:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww5Hrp6YyitDtUZ87KQIHnOt4DNHS3P0I+K/9ZWdkRSk2V5cOfau+BdEAcTW6x8CDaB6+6 X-Received: by 2002:a63:356:0:b0:3fd:7477:63f0 with SMTP id 83-20020a630356000000b003fd747763f0mr7919815pgd.601.1654492578125; Sun, 05 Jun 2022 22:16:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654492578; cv=none; d=google.com; s=arc-20160816; b=KrL4dfu2P2xFaeTOa8ePy4MCrJUVRY+qxymhMiN4c9glKd4JmzWMXf+4LODW6Ocopx HLzkra5hORWDN0kI/Kc9o3wmuFV3JUbeJIPNf5PFlYjtGBLtWeBbEcNh4vbwGHHkJGp5 U2T3mOi2ZWrFr+hyyKKN3cc9O83ODM1t28cNwOEzrS6o2PIl7D3dE4odcK8PzzP5uB4F Uu1yGzoOtaqPaTcVBn+FKn5CW7Ipp1Mq711W1xAL1QZo78n3+L2P1kV4BCsG8BQci104 RKFperwBDQkukGVAOtraYesj2BtH+W9Ceim6v01hdYZ4QfHeNNatDSYvhr5AwQSL8KJJ mnDg== 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=4OEENwRO4vxWhlD4LTqxsRNFSiw9+CrxcFmy9V5KiTU=; b=dRV1Z69VvXfog2stu+f/3RRcq49+WS3o2eHIPfgbu93QCak+/nbrIbCXTIwB1SxqIR 0P6ehjmbcWLNPHU8KgeHHDalc4C4GfoCfoRYjxP8U1h743mc/37B6ycKsnb2VOi8njrp vtJeBi7vF93QHWgV1VMzlTtpy63rxqaaYa3MjjJbVqnGDJ2qI2Wfwp5jhHOplFHo3gzM FnzbcvTFzFgpq7dbQWpTaopz+V30SU07ad416BDvTEiGhygyPX6IDkuZNrywCqGE3TP7 VelrgidAG6AqDK29QpdnOmQz2M8r7kSO5IbgXglwHZIdEmtD6OzcrbrdDqQAtMk2NjhU fGEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QrxZztDQ; 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 n7-20020a170902e54700b00153b2d1653asi23394856plf.322.2022.06.05.22.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:16:18 -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=QrxZztDQ; 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 30DCC179C3E; Sun, 5 Jun 2022 21:22:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346252AbiFCSAH (ORCPT + 99 others); Fri, 3 Jun 2022 14:00:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346691AbiFCRv1 (ORCPT ); Fri, 3 Jun 2022 13:51:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABF3E57157; Fri, 3 Jun 2022 10:49:11 -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 2D76E60F84; Fri, 3 Jun 2022 17:49:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D63CC385A9; Fri, 3 Jun 2022 17:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654278550; bh=DMacl7IqcY9xhZ6LfYAKsMrAmHpww3Czq1nsjIJ4w0g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QrxZztDQ/l4P6j3vBQ4Hn/G9ArFOz8dZ7vJwu1rqNAaAbPXOpkriNFIywQsAZFVLH ps75ECE+7jrki1FHtaUIg5majGpTvV8sLwQ06Q5vGxDYqYgXojFX1WHnqJHR9Gu82F x6O3dUaO9xNp7/vMh8C5nY+b49pKcrbJyoh/FZTg= 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.15 16/66] drm/i915: Fix -Wstringop-overflow warning in call to intel_read_wm_latency() Date: Fri, 3 Jun 2022 19:42:56 +0200 Message-Id: <20220603173821.132147840@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603173820.663747061@linuxfoundation.org> References: <20220603173820.663747061@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 @@ -2863,7 +2863,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;