drm/amd/display: fix bug of accessing invalid memory
authorSu Sung Chung <Su.Chung@amd.com>
Thu, 20 Sep 2018 19:03:27 +0000 (15:03 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Nov 2018 08:19:08 +0000 (09:19 +0100)
commit139dde1e967d3aa64d4fc4d10fced9ba5d95431a
treeb81c4836442c55f7e371c127bf3fb542861cd4aa
parent56e4367f7c43dc63f875a4bcd2057b5fbb88f5fd
drm/amd/display: fix bug of accessing invalid memory

[ Upstream commit 43c3ff27a47d83d153c4adc088243ba594582bf5 ]

[Why]
A loop inside of build_evenly_distributed_points function that traverse through
the array of points become an infinite loop when m_GammaUpdates does not
get assigned to any value.

[How]
In DMColor, clear m_gammaIsValid bit just before writting all Zeromem for
m_GammaUpdates, to prevent calling build_evenly_distributed_points
before m_GammaUpdates gets assigned to some value.

Signed-off-by: Su Sung Chung <Su.Chung@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/display/modules/color/color_gamma.c