OSDN Git Service

drm/amd/display: Guard against invalid array access
authorAric Cyr <aric.cyr@amd.com>
Wed, 13 May 2020 03:36:05 +0000 (23:36 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 28 May 2020 18:00:51 +0000 (14:00 -0400)
commit245a022163abd3d67ebc3757199d4d6eb4661bf8
treede0911a67b76cd73b8144b6b88ec687724cb502e
parent15ce104c5a419723f61a186e3711d8e50b131609
drm/amd/display: Guard against invalid array access

[Why]
There are scenarios where no OPP is assigned to an OTG so its value is
0xF which is outside the size of the OPP array causing a potential
driver crash.

[How]
Change the assert to an early return to guard against access.  If
there's no OPP assigned already, then OTG will be blank anyways so no
functionality should be lost.

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Zhan Liu <Zhan.Liu@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c