Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3135228ybi; Thu, 18 Jul 2019 21:43:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxQrPwkpZFZ72dJBGQuNKElq+73rlwaoRJbk1Mxzh7tJKvjklsoA8Xp/3M5wXIz9ErhXMF X-Received: by 2002:a63:60c1:: with SMTP id u184mr48049421pgb.275.1563511395673; Thu, 18 Jul 2019 21:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563511395; cv=none; d=google.com; s=arc-20160816; b=A8X6o4Z+/K+S7cHSk1zdy9EslI2u+4lBduYosxRR5MPYDxEL0kfT6JmAh8KhnmeXrQ vI/Kd37TsuwpFlfM3d0lcX+bs8vFRmslakqO/W0seY841fwFYpLawaef3wzFG2geZLl1 raWajfweNd0Y952m8DkPcYtaS6wmP5fQkijNUrSMBX9aXhGMhOWRfzlhk7MFenuzk+b9 b9eeeS8V5O9y9Wh2U+2hd7Cd5MJDzp4487nHZbHSzkuUy+XeN+Rr7DeIUr3xK9ZW70xE atGm3NuuvFpakVB1WiHgajas+99s9K8x78GJkXRdQX0+Fq1GKDeXDKrMYiZgfzxm15wz mJDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aBLwp0JYI3HQombL6LcMtgOCjsJBMm9SHSRLqP8EvBo=; b=xsq6Zq8cvymJlgAdzWgZopQmUKMh++lyvrL/0qKl4hMGK7wfMVeiw68tEd6HIsHTZD AFGA0B5n3dztwFupKD+Ca5q7RmQacWOFSa+9j7Ar1l0HWVzr/K9+wO6c4eDqk+NOWPlA KNXNI+sQVnwkOLldeLiCz+t89ASPq1VHCHyNpQ9t1uGB6w87qymFywyChJqqs1qyE9nY MrvalPj2RLDues45RyQx22B8FHU2hCHyQdtR1qBqHC93HKcKgpGZcBzD7LUS6FLSIcE4 0+v7stV2mY9eb8G+XjWRN7+sxgu5HSG1E0wUGubG6TCa9o9PzE5ULlYXo0DHleYgMkO8 mrmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cQ3c8J9s; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1si180193pgq.540.2019.07.18.21.42.59; Thu, 18 Jul 2019 21:43:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cQ3c8J9s; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727520AbfGSD5t (ORCPT + 99 others); Thu, 18 Jul 2019 23:57:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:56988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727356AbfGSD5r (ORCPT ); Thu, 18 Jul 2019 23:57:47 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 80D6821871; Fri, 19 Jul 2019 03:57:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508666; bh=UJ8o40MnRa0TvyAlLFj1vsaGUepF8iH+DWh2dyqDQKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cQ3c8J9s19m9wijso+Gw3/ST3BLGkfqGzcRJdHIy4iChpRJBT01m/3eyVh8JcAUk6 9o4T6fT0e4v4zvO7pm0BkHL6I5bAoi7S0YP9qhvVRDJygjLKpZrVGNuPjZnhBpdfqV ZHV899Ppj1fd6Q7BmhtCU6jDAkwhUhgwIK9SHpK4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Roman Li , David Francis , Bhawanpreet Lakha , Alex Deucher , Sasha Levin , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.2 022/171] drm/amd/display: Fill plane attrs only for valid pxl format Date: Thu, 18 Jul 2019 23:54:13 -0400 Message-Id: <20190719035643.14300-22-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roman Li [ Upstream commit 1894478ad1f8fd7366edc5cee49ee9caea0e3d52 ] [Why] In fill_plane_buffer_attributes() we calculate chroma/luma assuming that the surface_pixel_format is always valid. If it's not the case, there's a risk of divide by zero error. [How] Check if format valid before calculating pixel format attributes Signed-off-by: Roman Li Reviewed-by: David Francis Acked-by: Bhawanpreet Lakha Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index fa268dd736f4..31530bfd002a 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2592,7 +2592,7 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev, address->type = PLN_ADDR_TYPE_GRAPHICS; address->grph.addr.low_part = lower_32_bits(afb->address); address->grph.addr.high_part = upper_32_bits(afb->address); - } else { + } else if (format < SURFACE_PIXEL_FORMAT_INVALID) { uint64_t chroma_addr = afb->address + fb->offsets[1]; plane_size->video.luma_size.x = 0; -- 2.20.1