Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp121029iof; Sun, 5 Jun 2022 23:00:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKu8tBwuzSGTghIznx9DUWRdSVeeGoiR+SpfJ155VGKnBj/TUDzRARCixEBUAC0W7DBqhS X-Received: by 2002:a17:902:da88:b0:167:5b56:8edb with SMTP id j8-20020a170902da8800b001675b568edbmr11764107plx.71.1654495242070; Sun, 05 Jun 2022 23:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654495242; cv=none; d=google.com; s=arc-20160816; b=ueHloIAllAqMZCN18BkCOkmUn1KYsmi6J29QGmXKyJDJ45WfVcoxmMj5ndrz18Z03p ztPRjzFz6xHczkJShONZw8YAKIeoue6ibJAGQ0JrrT7BYoGcSEOqnfSfdg4s8cA20XGM 9+wYz+iixLCD+Jp5fpojX4OQk9bMk6dhr3owpXedQSXDi/0oMH4kYs3ZdTPGpTnFUB3E u8ZQcsHKgVylgYTmppqUYdQBMsKqxIv/WiEZHFkg6jpLT3Et639u4ZBAP4iZ56l18KEM WIVghGVfP+kN+NvSfl31rQ1qMP5UiUHQ1rqiNZY1uRxRS3cS35Tu0tF3ag5FY6pLQrar /N5g== 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=JOQX+mCO8Z1XSoSJWx67UO4we6oSl3rGWoPy+fRiGm0=; b=cBbVGOeOrkwHBJ9YRoVhZz573yi4sfnC2kc4zqdrwTbZg7pkClzj4/AG67Ql8/+LK0 RYSyGOcWMEzifnwiWhJd6kzt+i+67RDaCDm8F5SpzUUULCW0JO/CIva7bbBkCIcLNrSM 84bxD45HDoYSa0GCTuiIxko2hHfKMuv54ey3BaojsJbCnOWG6bOSRqXL7Js9BZXuRS0o 3EvUDb9wyMYvSxRnrBnCXLWckffLwRs4bNYDUheYHS8THhCYFwjrMMmZUUw5eu6rWxJZ zIgazgj+N4FlWn6jhSJEP4odegbA56LYy251wb4DPff7CZFmnoxJ+TB/fq5SDju0r4DF ZyDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OCil8AJR; 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 v6-20020a62a506000000b0050a6c1711d7si8459396pfm.336.2022.06.05.23.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 23:00:42 -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=OCil8AJR; 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 493C29D4F0; Sun, 5 Jun 2022 21:48:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238167AbiFCSQz (ORCPT + 99 others); Fri, 3 Jun 2022 14:16:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347012AbiFCSFe (ORCPT ); Fri, 3 Jun 2022 14:05:34 -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 8EA3B5A593; Fri, 3 Jun 2022 10:58:25 -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 E7DA7615DE; Fri, 3 Jun 2022 17:57:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD8DDC385B8; Fri, 3 Jun 2022 17:57:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654279058; bh=9TzOxzYF8eQz/bXIO0PdNTDxg8YV9WqOGd1aYO4rg/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OCil8AJRxSGbAiw4GlZWq5LW0wKaVaaUQEwdpuwEqWhPaNPv2W0QK8nNCxLM9eRDK YVwh23v1PR5NH/w3NZ/7wb5St16tQcNiuc/0CQpJL7rZo1RkUz+D8VzT7QVWf9GlUh UeDHUK+cqlEUMNAFvDxi39W8zvsLAgOXE8V12s9g= 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.18 07/67] drm/i915: Fix -Wstringop-overflow warning in call to intel_read_wm_latency() Date: Fri, 3 Jun 2022 19:43:08 +0200 Message-Id: <20220603173820.944138268@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603173820.731531504@linuxfoundation.org> References: <20220603173820.731531504@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 @@ -2859,7 +2859,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;