linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] i915: correctly handling failed allocation
@ 2015-12-30 15:59 Insu Yun
  2016-01-04 14:06 ` Jani Nikula
  0 siblings, 1 reply; 2+ messages in thread
From: Insu Yun @ 2015-12-30 15:59 UTC (permalink / raw)
  To: daniel.vetter, jani.nikula, airlied, intel-gfx, dri-devel,
	linux-kernel
  Cc: taesoo, yeongjin.jang, insu, changwoo, Insu Yun

Since devm_kzalloc can be failed, it needs to be checked
if not, NULL dereference could be happened.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index a5e99ac..aa1f7bc 100644
--- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
+++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -666,6 +666,8 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 
 	/* This is cheating a bit with the cleanup. */
 	vbt_panel = devm_kzalloc(dev->dev, sizeof(*vbt_panel), GFP_KERNEL);
+	if (!vbt_panel)
+		return NULL;
 
 	vbt_panel->intel_dsi = intel_dsi;
 	drm_panel_init(&vbt_panel->panel);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] i915: correctly handling failed allocation
  2015-12-30 15:59 [PATCH v2] i915: correctly handling failed allocation Insu Yun
@ 2016-01-04 14:06 ` Jani Nikula
  0 siblings, 0 replies; 2+ messages in thread
From: Jani Nikula @ 2016-01-04 14:06 UTC (permalink / raw)
  To: Insu Yun, daniel.vetter, airlied, intel-gfx, dri-devel,
	linux-kernel
  Cc: taesoo, yeongjin.jang, insu, changwoo, Insu Yun

On Wed, 30 Dec 2015, Insu Yun <wuninsu@gmail.com> wrote:
> Since devm_kzalloc can be failed, it needs to be checked
> if not, NULL dereference could be happened.
>
> Signed-off-by: Insu Yun <wuninsu@gmail.com>

Pushed to drm-intel-next-queued, thanks for the patch.

BR,
Jani.

> ---
>  drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index a5e99ac..aa1f7bc 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -666,6 +666,8 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
>  
>  	/* This is cheating a bit with the cleanup. */
>  	vbt_panel = devm_kzalloc(dev->dev, sizeof(*vbt_panel), GFP_KERNEL);
> +	if (!vbt_panel)
> +		return NULL;
>  
>  	vbt_panel->intel_dsi = intel_dsi;
>  	drm_panel_init(&vbt_panel->panel);

-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-04 14:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-30 15:59 [PATCH v2] i915: correctly handling failed allocation Insu Yun
2016-01-04 14:06 ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).