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 B2A2A18DF73; Tue, 10 Sep 2024 10:39:01 +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=1725964741; cv=none; b=qB/b9xIXKg/3BMDqmdapZvLEg26OnSHoLNlp499iN5w91i5jANu693/T7F8sw63EneCXc0MRrB7KvYhTqeWT1GSuOZ7yOr97bQAsc5nuDxZ2LysHyIp2D8DmQ6LFXZDO4uF1h/uIw4PILhd9YPhOhV689zUU6m9zdhT/TnRsMuw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725964741; c=relaxed/simple; bh=ZisZPKBlT+JkJZ5kOW8Rf848jOG1KYhazO7ZsQfbeKQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IEMFU07i4UguUFn1rxlPckq6V3hx2IbUz01uE4eKjyEJTZDmke7Ue6Jf9HwNcFS5fXoEcj17+1CMjNIjnhcc1dpkx/F6m3s19TqkPF3XGaplrfyC6gNgR79/VJNBUnjIgS4p87zxVbC9gHO/cm6y/xZI2s4xcVWXDtkCNULH0pE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xXJg9bsb; 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="xXJg9bsb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39407C4CEC3; Tue, 10 Sep 2024 10:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725964741; bh=ZisZPKBlT+JkJZ5kOW8Rf848jOG1KYhazO7ZsQfbeKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xXJg9bsbXawmvYnf9a5tZEYdcRT+6WBqiL0EU30ukzqHStEsrU7BjR2SyAjr0ho3N QwlLIxOjBtkmnX89r907JPs8QOAuGuZsm4bej/AGoCi5NiuSOTE89YduYVvuuZltzT KP2GdNAOSkTDuwmZvBMlP2shnfcMaa3r094Ju3TM= 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.10 016/186] drm/amd/display: Stop amdgpu_dm initialize when stream nums greater than 6 Date: Tue, 10 Sep 2024 11:31:51 +0200 Message-ID: <20240910092555.303699208@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092554.645718780@linuxfoundation.org> References: <20240910092554.645718780@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.10-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 29ef0ed44d5f..50921b340b88 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3341,7 +3341,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