[PATCH] amd/display: Fix potential null dereference in dce_calcs.c
Deucher, Alexander
Alexander.Deucher at amd.com
Wed Nov 8 20:54:10 UTC 2017
> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Ernst Sjöstrand
> Sent: Wednesday, November 08, 2017 3:17 PM
> To: amd-gfx at lists.freedesktop.org
> Subject: [PATCH] amd/display: Fix potential null dereference in dce_calcs.c
>
> Reported by smatch:
> bw_calcs() error: potential null dereference 'data'
>
> Signed-off-by: Ernst Sjöstrand <ernstp at gmail.com>
> ---
> drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> index 4f8a95368ffc..64a885195208 100644
> --- a/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> +++ b/drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
> @@ -2794,6 +2794,10 @@ bool bw_calcs(struct dc_context *ctx,
> {
> struct bw_calcs_data *data = kzalloc(sizeof(struct bw_calcs_data),
> GFP_KERNEL);
> + if (!data) {
> + DRM_ERROR("Failed to allocate bw_calcs_data\n");
I think we are trying to keep DRM specifics out of dc as much as possible so drop the error message and just return false.
Thanks!
Alex
> + return false;
> + }
>
> populate_initial_data(pipe, pipe_count, data);
>
> --
> 2.14.1
>
> _______________________________________________
> 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