[PATCH] amdgpu/dc: handle allocation failures in dc_commit_planes_to_stream.
Harry Wentland
harry.wentland at amd.com
Tue Nov 7 19:32:46 UTC 2017
On 2017-11-07 08:05 AM, Andrey Grodzovsky wrote:
> Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
>
>
> On 11/06/2017 02:21 PM, Dave Airlie wrote:
>> From: Dave Airlie <airlied at redhat.com>
>>
>> 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)
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
Reviewed-by: Harry Wentland <harry.wentland at amd.com>
Harry
>> ---
>> drivers/gpu/drm/amd/display/dc/core/dc.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
>> index a71392f..ce3c57b 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;
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
More information about the amd-gfx
mailing list