Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1519686

Re: [PATCH] Gpu: drm: arm: - Fix possible dereference of NULL

From Liviu Dudau <liviu.dudau@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Gpu: drm: arm: - Fix possible dereference of NULL
Date 2016-11-11 12:00 +0100
Message-ID <sChIR-3fv-3@gated-at.bofh.it> (permalink)
References <sCfH3-1Zq-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Shailendra,

On Fri, Nov 11, 2016 at 02:16:08PM +0530, Shailendra Verma wrote:
> From: "Shailendra Verma" <shailendra.v@samsung.com>
> 
> There is possible dereference of NULL pointer if kmalloc fails.

You could add: ... when the function returns. From the patch itself it is
not clear where the problem is.

> So return NULL if kmalloc fails.
> 
> Signed-off-by: Shailendra Verma <Shailendra.v@samsung.com>

Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>

Thanks for spotting this!
Liviu

> ---
>  drivers/gpu/drm/arm/malidp_planes.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index 82c193e..f769398 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -54,6 +54,9 @@ struct drm_plane_state *malidp_duplicate_plane_state(struct drm_plane *plane)
>  		return NULL;
>  
>  	state = kmalloc(sizeof(*state), GFP_KERNEL);
> +	if (!state)
> +		return NULL;
> +
>  	if (state) {
>  		m_state = to_malidp_plane_state(plane->state);
>  		__drm_atomic_helper_plane_duplicate_state(plane, &state->base);
> -- 
> 1.7.9.5
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] Gpu: drm: arm: - Fix possible dereference of NULL Shailendra Verma <shailendra.v@samsung.com> - 2016-11-11 09:50 +0100
  Re: [PATCH] Gpu: drm: arm: - Fix possible dereference of NULL Liviu Dudau <liviu.dudau@arm.com> - 2016-11-11 12:00 +0100
    Re: [PATCH] Gpu: drm: arm: - Fix possible dereference of NULL Emil Velikov <emil.l.velikov@gmail.com> - 2016-11-11 15:00 +0100
      Re: [PATCH] Gpu: drm: arm: - Fix possible dereference of NULL Liviu Dudau <liviu.dudau@arm.com> - 2016-11-11 15:40 +0100

csiph-web