From patchwork Mon Mar 22 16:02:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 406167 Delivered-To: patch@linaro.org Received: by 2002:a17:906:5290:0:0:0:0 with SMTP id c16csp1348747ejm; Mon, 22 Mar 2021 09:05:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySQsZpjqM9fbNTP6KSFPWp7sDyICgY/nxf66pMlf3LbkRPjH/O9Md03SAcg8lROz+R9f4F X-Received: by 2002:a63:fa02:: with SMTP id y2mr271875pgh.412.1616429145931; Mon, 22 Mar 2021 09:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616429145; cv=none; d=google.com; s=arc-20160816; b=E0q6yRlKNT48phzUtEcYFLGMrkpHIZROEay18evhFGu0EDrookKoLLZCxLTDumqHvp K791tTUwfZpoBUYRPtUzo0z8fYSG6bWEZryQRsd2xm9/O6aEmGwNLUcN1O/McjiyhHSu jmfhKERtZYrAnvtGabrEY1OV4lTQHrtaQsSrZ2A4LatxXKIjtXJ4UbT+GHEJkAJWKYgG V8I0yhq1jDj84VTpHpHuqACqS6v/sbLRj8sHDD10XrmmE/C/8j4lQxgSf6tAH/pfH3hD cvOmPahv6IGtaPkRI/2r0b2xKGQbYnUPmwb4QVrCTW/Vsab8zBPhw8JCnIyw9dgajU/G eNcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to; bh=KkMTz7bKFDa85flXoQs85USEpQyzT0SwJ/+yGYZgsSc=; b=Lbcg8JdS4qjDX+9KJueumDiUkpjDWW0Bs2pcqHT1AOCkBLeSrI/P+QVv3+wPms/UAF l46zhNTl3KB37H5Wgz616k68mL2go5w0ZOhob2NVfk/PXrV8GYT0TDPXv/ZCXednMlPR KfBLReZOPNvj6sfGS4vd5yzO5zHOVEXoE5xAq5IGpPafhKhaxuMz3F1Tke3wNcSqOuUW wdLXCRoPWQO0O5qP2W+zQp82o+09VSgkLfQgZRaFX+QOk7UuoH6HFHTDVUUB0PPsHbpB oTcw3aKH5vkuFuRhIUlIcO7atAVIuLnUdKk594SrPnO0RFU1MjfSdolp1g/3oKMdmtAQ ateg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=KfNQhB8I; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 15si15793803pfw.144.2021.03.22.09.05.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 09:05:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=KfNQhB8I; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E716F6E507; Mon, 22 Mar 2021 16:05:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4984E6E507; Mon, 22 Mar 2021 16:05:43 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 49D21619CF; Mon, 22 Mar 2021 16:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616429143; bh=ppc9fZupOrjA6hpvzPGCige1HMZi82rKq0OzuPiwp30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KfNQhB8I6TCilI9rWZIUvrD60VxxXK7zzzf2CzYQVcPCX4dTFC+5vrq57/HXue9eN 7bPBi+K09Uuo8FgLHJN5cLADDDnPtd+D6sEhJhO/VLvKBoLaRa1BESfKHtMpZuvnwh D3Vc4uZU9Dcg74j9eeiZa4qkcbeOz2ZvcezhMcicUmJ4FzCGExiFKR4ER32CvaOaWV akMTcdJNfGrFGH5JvGZ7qns0oNxpRTzGH0qZ76EqyoQfhjLJvxqyHurET1PBvf6svb dBMESSwDo3iJsmPDGBQ1mVtfw03/ahNqDciEznfWOfvZZJNzU8YYxi4I1doMFPdTRo oo8eGNoKcMUqQ== From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Martin Sebor , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter Subject: [PATCH 11/11] [RFC] drm/i915/dp: fix array overflow warning Date: Mon, 22 Mar 2021 17:02:49 +0100 Message-Id: <20210322160253.4032422-12-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210322160253.4032422-1-arnd@kernel.org> References: <20210322160253.4032422-1-arnd@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, linux-scsi@vger.kernel.org, Animesh Manna , x86@kernel.org, James Smart , tboot-devel@lists.sourceforge.net, Uma Shankar , Kalle Valo , Ankit Nautiyal , ath11k@lists.infradead.org, Serge Hallyn , Arnd Bergmann , "James E.J. Bottomley" , Gwan-gyeong Mun , Ning Sun , Anders Larsen , Sean Paul , cgroups@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, Manasi Navare , linux-security-module@vger.kernel.org, Tejun Heo , Simon Kelley , intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Arnd Bergmann gcc-11 warns that intel_dp_check_mst_status() has a local array of fourteen bytes and passes the last four bytes into a function that expects a six-byte array: drivers/gpu/drm/i915/display/intel_dp.c: In function ‘intel_dp_check_mst_status’: drivers/gpu/drm/i915/display/intel_dp.c:4556:22: error: ‘drm_dp_channel_eq_ok’ reading 6 bytes from a region of size 4 [-Werror=stringop-overread] 4556 | !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/intel_dp.c:4556:22: note: referencing argument 1 of type ‘const u8 *’ {aka ‘const unsigned char *’} In file included from drivers/gpu/drm/i915/display/intel_dp.c:38: include/drm/drm_dp_helper.h:1459:6: note: in a call to function ‘drm_dp_channel_eq_ok’ 1459 | bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE], | ^~~~~~~~~~~~~~~~~~~~ Clearly something is wrong here, but I can't quite figure out what. Changing the array size to 16 bytes avoids the warning, but is probably the wrong solution here. Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/i915/display/intel_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 8c12d5375607..830e2515f119 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -65,7 +65,7 @@ #include "intel_vdsc.h" #include "intel_vrr.h" -#define DP_DPRX_ESI_LEN 14 +#define DP_DPRX_ESI_LEN 16 /* DP DSC throughput values used for slice count calculations KPixels/s */ #define DP_DSC_PEAK_PIXEL_RATE 2720000