amdgpu/dc: handle allocation failures in dc_commit_planes_to_stream.
Subsystems (3)
PATCH 1/1 amdgpu/dc: handle allocation failures in dc_commit_planes_to_stream.
From: Dave Airlie <[email protected]>
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)
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +8 -0
@@ -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;
Signature · 6 lines
2.9.5 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20171106192118.24084-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Andrey Grodzovsky
Reviewed-byQuoted 21 lines · Dave Airlie
From: Dave Airlie <[email protected]>
Reported-by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:966dc_commit_planes_to_stream()error: potential null dereference 'flip_addr'. (kcalloc returns null)drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:968dc_commit_planes_to_stream()error: potential null dereference 'plane_info'. (kcalloc returns null)drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:978dc_commit_planes_to_stream()error: potential null dereference 'scaling_info'. (kcalloc returns null)Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/amd/display/dc/core/dc.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/amd/display/dc/core/dc.c +1
-0@@ -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) {
drivers/gpu/drm/amd/display/dc/core/dc.c bool dc_commit_planes_to_stream( · line 965
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +7
-0+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;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): ff1e489c-9bec-45cd-9d24-c7a6e1aa26d7-5C7GfCeVMHo@public.gmane.org
Harry Wentland
Reviewed-byQuoted 12 lines · Andrey Grodzovsky
Reviewed-by Andrey Grodzovsky <[email protected]>Quoted 8 lines · Dave Airlie
From: Dave Airlie <[email protected]>
Reported-by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:966dc_commit_planes_to_stream()error: potential null dereference 'flip_addr'. (kcalloc returns null)drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:968dc_commit_planes_to_stream()error: potential null dereference 'plane_info'. (kcalloc returns null)drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:978dc_commit_planes_to_stream()error: potential null dereference 'scaling_info'. (kcalloc returns null)Signed-off-by Dave Airlie <[email protected]>
Harry
Quoted 18 lines
Quoted 18 lines
---
drivers/gpu/drm/amd/display/dc/core/dc.c| 8 ++++++++1 file changed, 8 insertions(+)drivers/gpu/drm/amd/display/dc/core/dc.c +6
-0@@ -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; + }
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/core/dc.c bool dc_commit_planes_to_stream( · line 965
Quoted 3 lines
drivers/gpu/drm/amd/display/dc/core/dc.c +1
-0+ memset(updates, 0, sizeof(updates)); stream_update->src = dc_stream->src;_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx