提交 001a49f9 编写于 作者: A Anson Jacob 提交者: Zheng Zengkai

drm/amd/display: Fix UBSAN warning for not a valid value for type '_Bool'

stable inclusion
from stable-5.10.36
commit 9cc76f29b9e54a7e727c1c0d2d5210735d34b079
bugzilla: 51867
CVE: NA

--------------------------------

[ Upstream commit 6a30a929 ]

[Why]
dc_cursor_position do not initialise position.translate_by_source when
crtc or plane->state->fb is NULL. UBSAN caught this error in
dce110_set_cursor_position, as the value was garbage.

[How]
Initialise dc_cursor_position structure elements to 0 in handle_cursor_update
before calling get_cursor_position.
Tested-by: NDaniel Wheeler <daniel.wheeler@amd.com>
Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1471Reported-by: NLyude Paul <lyude@redhat.com>
Signed-off-by: NAnson Jacob <Anson.Jacob@amd.com>
Reviewed-by: NAurabindo Jayamohanan Pillai <Aurabindo.Pillai@amd.com>
Acked-by: NSolomon Chiu <solomon.chiu@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 ccd87733
...@@ -6800,10 +6800,6 @@ static int get_cursor_position(struct drm_plane *plane, struct drm_crtc *crtc, ...@@ -6800,10 +6800,6 @@ static int get_cursor_position(struct drm_plane *plane, struct drm_crtc *crtc,
int x, y; int x, y;
int xorigin = 0, yorigin = 0; int xorigin = 0, yorigin = 0;
position->enable = false;
position->x = 0;
position->y = 0;
if (!crtc || !plane->state->fb) if (!crtc || !plane->state->fb)
return 0; return 0;
...@@ -6850,7 +6846,7 @@ static void handle_cursor_update(struct drm_plane *plane, ...@@ -6850,7 +6846,7 @@ static void handle_cursor_update(struct drm_plane *plane,
struct dm_crtc_state *crtc_state = crtc ? to_dm_crtc_state(crtc->state) : NULL; struct dm_crtc_state *crtc_state = crtc ? to_dm_crtc_state(crtc->state) : NULL;
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
uint64_t address = afb ? afb->address : 0; uint64_t address = afb ? afb->address : 0;
struct dc_cursor_position position; struct dc_cursor_position position = {0};
struct dc_cursor_attributes attributes; struct dc_cursor_attributes attributes;
int ret; int ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册