From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CD2317C7A3; Tue, 10 Sep 2024 10:15:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725963321; cv=none; b=KI6lzC+qALu36LktWl9PCQsw8cvF5174ZiDGQUs+15UNjmc/YMiYRwtWJ0EUA5Sn1jnheq05vK4zgzA/LFvrwilbgoJVGg80NYa51irkLdERgbiwzKOCWRqGqeor+meEatgsnxNdNpvip8ycqNf18O5tzrb9RxB2WGNw/VNunzs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725963321; c=relaxed/simple; bh=bwCqCxyg2qnKEpAqbE2JLIJIS7xfK0lKFV4aaVLjzls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sla89BLvftN1eEIEwPK6em/SKv9AyO40vPkt1Phr2r6YkcS+U7UlrVQz5hWnT2rsH3PpPIJei+yCDoPXUqfLxtUwyDR7oXQIF0zgy0MUGnj3ab7wDmI9jEVRpwh31W/VmN4Wn9var37dVFaEJmQm8CgR2gaduORs7wBqO2UhmsI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gQuMUxcw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gQuMUxcw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B82E9C4CEC3; Tue, 10 Sep 2024 10:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725963321; bh=bwCqCxyg2qnKEpAqbE2JLIJIS7xfK0lKFV4aaVLjzls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQuMUxcwfESi5bKaNL9OYpaCPHobpyHvrTilf9EwRrleFBk1vwQPDCs5dZ3LPl3aI PCsccctulWCBRjz/smILZFPnmyw+4u6y3n/I4/MbIawVGTwTF9+5S4Qpl3R/Uax65e kK/68pDyOuwL8v7JyGnCaYTQwcwF46H8lpCvTVNA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Harry Wentland , Tom Chung , Hersen Wu , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 018/214] drm/amd/display: Stop amdgpu_dm initialize when stream nums greater than 6 Date: Tue, 10 Sep 2024 11:30:40 +0200 Message-ID: <20240910092559.510017432@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092558.714365667@linuxfoundation.org> References: <20240910092558.714365667@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hersen Wu [ Upstream commit 84723eb6068c50610c5c0893980d230d7afa2105 ] [Why] Coverity reports OVERRUN warning. Should abort amdgpu_dm initialize. [How] Return failure to amdgpu_dm_init. Reviewed-by: Harry Wentland Acked-by: Tom Chung Signed-off-by: Hersen Wu Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 5 ++++- 1 file changed, 4 insertions(+), 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 333be0541893..b4ae90c3ed23 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4211,7 +4211,10 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) /* There is one primary plane per CRTC */ primary_planes = dm->dc->caps.max_streams; - ASSERT(primary_planes <= AMDGPU_MAX_PLANES); + if (primary_planes > AMDGPU_MAX_PLANES) { + DRM_ERROR("DM: Plane nums out of 6 planes\n"); + return -EINVAL; + } /* * Initialize primary planes, implicit planes for legacy IOCTLS. -- 2.43.0