mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gma500: medfield: fix potential NULL pointer dereference in mdfld_dsi_output_init()
@ 2012-10-07 13:56 Wei Yongjun
  2012-10-08 12:27 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2012-10-07 13:56 UTC (permalink / raw)
  To: airlied; +Cc: yongjun_wei, dri-devel, linux-kernel

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

The dereference should be moved below the NULL test.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/gpu/drm/gma500/mdfld_dsi_output.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
index 32dba2a..f92932f 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
@@ -500,17 +500,18 @@ void mdfld_dsi_output_init(struct drm_device *dev,
 	struct mdfld_dsi_connector *dsi_connector;
 	struct drm_connector *connector;
 	struct mdfld_dsi_encoder *encoder;
-	struct drm_psb_private *dev_priv = dev->dev_private;
+	struct drm_psb_private *dev_priv;
 	struct panel_info dsi_panel_info;
 	u32 width_mm, height_mm;
 
-	dev_dbg(dev->dev, "init DSI output on pipe %d\n", pipe);
-
 	if (!dev || ((pipe != 0) && (pipe != 2))) {
 		DRM_ERROR("Invalid parameter\n");
 		return;
 	}
 
+	dev_dbg(dev->dev, "init DSI output on pipe %d\n", pipe);
+	dev_priv = dev->dev_private;
+
 	/*create a new connetor*/
 	dsi_connector = kzalloc(sizeof(struct mdfld_dsi_connector), GFP_KERNEL);
 	if (!dsi_connector) {


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

* Re: [PATCH] gma500: medfield: fix potential NULL pointer dereference in mdfld_dsi_output_init()
  2012-10-07 13:56 [PATCH] gma500: medfield: fix potential NULL pointer dereference in mdfld_dsi_output_init() Wei Yongjun
@ 2012-10-08 12:27 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2012-10-08 12:27 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: airlied, yongjun_wei, linux-kernel, dri-devel

On Sun, 7 Oct 2012 21:56:45 +0800
Wei Yongjun <weiyj.lk@gmail.com> wrote:

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> The dereference should be moved below the NULL test.

The !dev check just wants removing I think - it's a bogus check in the
first place.

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

end of thread, other threads:[~2012-10-08 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-07 13:56 [PATCH] gma500: medfield: fix potential NULL pointer dereference in mdfld_dsi_output_init() Wei Yongjun
2012-10-08 12:27 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®