diff options
author | Dave Airlie <[email protected]> | 2017-11-07 05:21:18 +1000 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2017-11-07 16:22:08 -0500 |
commit | f7dbc385c15084d6e11192e8a5dd901eb96dbec2 (patch) | |
tree | f502890a757d80b5dc34036650d0e59914ce3672 | |
parent | bf5563ede9f254fba083c6b56e4ca8b836babb1d (diff) |
amdgpu/dc: handle allocation failures in dc_commit_planes_to_stream.
Reported-by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:966 dc_commit_planes_to_stream() error: potential null dereference 'flip_addr'. (kcalloc returns null)
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:968 dc_commit_planes_to_stream() error: potential null dereference 'plane_info'. (kcalloc returns null)
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:978 dc_commit_planes_to_stream() error: potential null dereference 'scaling_info'. (kcalloc returns null)
Reviewed-by: Andrey Grodzovsky <[email protected]>
Reviewed-by: Harry Wentland <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/core/dc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index a71392ffc46d..ce3c57b38bc0 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -952,6 +952,14 @@ bool dc_commit_planes_to_stream( scaling_info = kcalloc(MAX_SURFACES, sizeof(struct dc_scaling_info), GFP_KERNEL); + if (!flip_addr || !plane_info || !scaling_info) { + kfree(flip_addr); + kfree(plane_info); + kfree(scaling_info); + kfree(stream_update); + return false; + } + memset(updates, 0, sizeof(updates)); stream_update->src = dc_stream->src; |