[PATCH v2] amd/display: Fix potential null dereference in dce_calcs.c

Alex Deucher alexdeucher at gmail.com
Wed Nov 8 22:05:56 UTC 2017


On Wed, Nov 8, 2017 at 4:47 PM, Ernst Sjöstrand <ernstp at gmail.com> wrote:
> Reported by smatch:
> bw_calcs() error: potential null dereference 'data'
>
> Signed-off-by: Ernst Sjöstrand <ernstp at gmail.com>

Reviewed and pushed.  thanks!

Alex

> ---
> I couldn't use DC_ERROR because the dc_context had the wrong variable
> name. Seems like a larger project to fix...
>
>  drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 2 ++
>  1 file changed, 2 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..6347712db834 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,8 @@ bool bw_calcs(struct dc_context *ctx,
>  {
>         struct bw_calcs_data *data = kzalloc(sizeof(struct bw_calcs_data),
>                                              GFP_KERNEL);
> +       if (!data)
> +               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