Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp561516pxf; Wed, 24 Mar 2021 10:24:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2+TEuIG6gUSkzH5GLcmvisT4YmfnFTm15DlXMzLdLOn4zJ2M0Sa1M5m7lal5rnyqo6oW/ X-Received: by 2002:a05:6402:3047:: with SMTP id bu7mr4578952edb.227.1616606645596; Wed, 24 Mar 2021 10:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616606645; cv=none; d=google.com; s=arc-20160816; b=Okxwzi9+w9R7i9nDYWshwo3EZdJrUJ9CiiBnRvH1l+IfiJIrO+HKYvVlEVNwDChQAq ZqaI0QZh3hP/a52C9V/yzW1XmxtfaupCcbMBghh1web3+5up3bhpH4Vqg3jsiFskHTeZ xXNfK8ECxt/pwLCgsDNZ1o9gB3N7xl4XS6JmJqyna8wunQvWV7wkLz/gJyxk9hL+Qckf 2l4YaxWfNaxBHCoj5v5wdYOFu2n1aYUmnzYmK7MssCkQA/ORDaAqIW9t1We4pvquefxr DmGYilA8zFMoqt7y0HTGnFBHbZ9iofVkYkE1/1d6Mpkr3lbMZzJEukEUjBmcTAIJ5LO4 Q+wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=Kfr06T5ikpIjkhPX8xhnhE/8W6GHQn3xwv7fqWV2nVs=; b=eOCwCVtWGHO48P10hXOs64FevUwmiDxSCHQmMkdYEF8VrjwEabhaf9NE5bZ8N9F2Ag U24oUnXCojT0aNlyyvpgVz84mIYRf94T4fZu6nTFWQXzANlq96nvH0AFCNrXCIyzPvX5 Uv6e11tABq9NXP1Fi7YtInJnpV2p1POAFQFGOd3vnrTsSecfcuDDUnCLaC9bX3xwRDlX EQo8+uNMi/HJ/Ag0fcYman+daq1WqhlGge13ODYTV1CyEZKorP6grqdmkbMoV+dP5DJb e0lz/W9NF87vifi2n7DBvy0C6K0uhkZGA4YZVnERA0i3Z8BnzbBe1ZNsQaAUDZQjxu5k EMTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yk13si2222405ejb.127.2021.03.24.10.23.40; Wed, 24 Mar 2021 10:24:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237125AbhCXRXK (ORCPT + 99 others); Wed, 24 Mar 2021 13:23:10 -0400 Received: from mga06.intel.com ([134.134.136.31]:16672 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237098AbhCXRW7 (ORCPT ); Wed, 24 Mar 2021 13:22:59 -0400 IronPort-SDR: cQtKDfGSRClLmG3tg20PD7vnKE61zdl5Iy47lu7s8sWzMA5CBf7KgaDKt61tL4HaJj+00Su1S3 pZ8MXBc748TA== X-IronPort-AV: E=McAfee;i="6000,8403,9933"; a="252110427" X-IronPort-AV: E=Sophos;i="5.81,275,1610438400"; d="scan'208";a="252110427" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 10:22:57 -0700 IronPort-SDR: q7x5MCG+vkoOU9Zt5AI1qoSHSHC0Zp99QAlPGLHuv2CUXVcGAPnke24VDa6jskQUUfvyu5ceVQ Ar5TomltcFSQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,275,1610438400"; d="scan'208";a="443059639" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.171]) by FMSMGA003.fm.intel.com with SMTP; 24 Mar 2021 10:22:49 -0700 Received: by stinkbox (sSMTP sendmail emulation); Wed, 24 Mar 2021 19:22:48 +0200 Date: Wed, 24 Mar 2021 19:22:48 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Jani Nikula Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, Martin Sebor , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , Arnd Bergmann , x86@kernel.org, Ning Sun , Kalle Valo , Simon Kelley , James Smart , "James E.J. Bottomley" , Anders Larsen , Tejun Heo , Serge Hallyn , Imre Deak , linux-arm-kernel@lists.infradead.org, tboot-devel@lists.sourceforge.net, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-scsi@vger.kernel.org, cgroups@vger.kernel.org, linux-security-module@vger.kernel.org, Chris Wilson , =?iso-8859-1?Q?Jos=E9?= Roberto de Souza , Matt Roper , Aditya Swarup Subject: Re: [PATCH 10/11] drm/i915: avoid stringop-overread warning on pri_latency Message-ID: References: <20210322160253.4032422-1-arnd@kernel.org> <20210322160253.4032422-11-arnd@kernel.org> <874kh04lin.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <874kh04lin.fsf@intel.com> X-Patchwork-Hint: comment Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Wed, Mar 24, 2021 at 05:30:24PM +0200, Jani Nikula wrote: > On Mon, 22 Mar 2021, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > gcc-11 warns about what appears to be an out-of-range array access: > > > > In function ‘snb_wm_latency_quirk’, > > inlined from ‘ilk_setup_wm_latency’ at drivers/gpu/drm/i915/intel_pm.c:3108:3: > > drivers/gpu/drm/i915/intel_pm.c:3057:9: error: ‘intel_print_wm_latency’ reading 16 bytes from a region of size 10 [-Werror=stringop-overread] > > 3057 | intel_print_wm_latency(dev_priv, "Primary", dev_priv->wm.pri_latency); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/gpu/drm/i915/intel_pm.c: In function ‘ilk_setup_wm_latency’: > > drivers/gpu/drm/i915/intel_pm.c:3057:9: note: referencing argument 3 of type ‘const u16 *’ {aka ‘const short unsigned int *’} > > drivers/gpu/drm/i915/intel_pm.c:2994:13: note: in a call to function ‘intel_print_wm_latency’ > > 2994 | static void intel_print_wm_latency(struct drm_i915_private *dev_priv, > > | ^~~~~~~~~~~~~~~~~~~~~~ > > > > My guess is that this code is actually safe because the size of the > > array depends on the hardware generation, and the function checks for > > that, but at the same time I would not expect the compiler to work it > > out correctly, and the code seems a little fragile with regards to > > future changes. Simply increasing the size of the array should help. > > Agreed, I don't think there's an issue, but the code could use a bunch > of improvements. > > Like, we have intel_print_wm_latency() for debug logging and > wm_latency_show() for debugfs, and there's a bunch of duplication and > ugh. There is all this ancient stuff in review limbo... https://patchwork.freedesktop.org/series/50802/ -- Ville Syrjälä Intel