drm/amd/display: Add NULL check for kzalloc in 'amdgpu_dm_atomic_commit_tail()'
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Tue, 30 Jan 2024 08:36:43 +0000 (14:06 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 31 Jan 2024 19:05:19 +0000 (14:05 -0500)
commit1c2806f6be230c33b3f2fa7ad581e2cf5d597abc
treedb6e7fda99710e09d0849cf46bfb0a482980a025
parentfa8a91b0e52c37627d01395baf5e7aae21dce5bf
drm/amd/display: Add NULL check for kzalloc in 'amdgpu_dm_atomic_commit_tail()'

Add a NULL check for the kzalloc call that allocates memory for
dummy_updates in the amdgpu_dm_atomic_commit_tail function. Previously,
if kzalloc failed to allocate memory and returned NULL, the code would
attempt to use the NULL pointer.

The fix is to check if kzalloc returns NULL, and if so, log an error
message and skip the rest of the current loop iteration with the
continue statement.  This prevents the code from attempting to use the
NULL pointer.

Cc: Julia Lawall <julia.lawall@inria.fr>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reported-by: Julia Lawall <julia.lawall@inria.fr>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202401300629.ICnCt983-lkp@intel.com/
Fixes: 135fd1b35690 ("drm/amd/display: Reduce stack size")
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c