]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu: Off by one in dm_dmub_outbox1_low_irq()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 16 May 2022 07:05:48 +0000 (10:05 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:41:21 +0000 (18:41 +0200)
[ Upstream commit a35faec3db0e13aac8ea720bc1a3503081dd5a3d ]

The > ARRAY_SIZE() should be >= ARRAY_SIZE() to prevent an out of bounds
access.

Fixes: e27c41d5b068 ("drm/amd/display: Support for DMUB HPD interrupt handling")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 24db2297857b41b2ede29254ad734f595f343918..edb5e72aeb6639a72af9150062d70643e21d4610 100644 (file)
@@ -767,7 +767,7 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params)
 
                do {
                        dc_stat_get_dmub_notification(adev->dm.dc, &notify);
-                       if (notify.type > ARRAY_SIZE(dm->dmub_thread_offload)) {
+                       if (notify.type >= ARRAY_SIZE(dm->dmub_thread_offload)) {
                                DRM_ERROR("DM: notify type %d invalid!", notify.type);
                                continue;
                        }