Skip to contentSkip to conversation

gma500: medfield: Fix possible NULL pointer dereference

PATCH In review Syam Sidhardhan 2 participants 3 messages Feb 24, 2013 – Apr 2, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gma500: medfield: Fix possible NULL pointer dereference

The use of pointer sender should be after the NULL check.

---
 drivers/gpu/drm/gma500/mdfld_dsi_output.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/gma500/mdfld_dsi_output.c +5 -2
index 2d4ab48..3abf831 100644
@@ -92,8 +92,8 @@ void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe)
 {
 	struct mdfld_dsi_pkg_sender *sender =
 				mdfld_dsi_get_pkg_sender(dsi_config);
-	struct drm_device *dev = sender->dev;
-	struct drm_psb_private *dev_priv = dev->dev_private;
+	struct drm_device *dev;
+	struct drm_psb_private *dev_priv;
 	u32 gen_ctrl_val;
 
 	if (!sender) {
@@ -101,6 +101,9 @@ void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe)
 		return;
 	}
 
+	dev = sender->dev;
+	dev_priv = dev->dev_private;
+
 	/* Set default display backlight value to 85% (0xd8)*/
 	mdfld_dsi_send_mcs_short(sender, write_display_brightness, 0xd8, 1,
 				true);
Signature · 1 line
1.7.9.5
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Syam Sidhardhan

The use of pointer sender should be after the NULL check.

---
 drivers/gpu/drm/gma500/mdfld_dsi_output.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/gma500/mdfld_dsi_output.c +2 -2
index 2d4ab48..3abf831 100644
@@ -92,8 +92,8 @@ void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe)
 {
 	struct mdfld_dsi_pkg_sender *sender =
 				mdfld_dsi_get_pkg_sender(dsi_config);
-	struct drm_device *dev = sender->dev;
-	struct drm_psb_private *dev_priv = dev->dev_private;
+	struct drm_device *dev;
+	struct drm_psb_private *dev_priv;
 	u32 gen_ctrl_val;
 
 	if (!sender) {

drivers/gpu/drm/gma500/mdfld_dsi_output.c void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe) · line 109

Quoted 9 lines
drivers/gpu/drm/gma500/mdfld_dsi_output.c +3 -0
@@ -101,6 +101,9 @@ void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe)
 		return;
 	}
 
+	dev = sender->dev;
+	dev_priv = dev->dev_private;
+
 	/* Set default display backlight value to 85% (0xd8)*/
 	mdfld_dsi_send_mcs_short(sender, write_display_brightness, 0xd8, 1,
 				true);
maintainer
#2 lore raw
In reply to Syam Sidhardhan
Quoted 33 lines · Syam Sidhardhan

The use of pointer sender should be after the NULL check.

---
 drivers/gpu/drm/gma500/mdfld_dsi_output.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/gma500/mdfld_dsi_output.c +5 -3
index 2d4ab48..3abf831 100644
@@ -92,8 +92,8 @@ void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe)
 {
        struct mdfld_dsi_pkg_sender *sender =
                                mdfld_dsi_get_pkg_sender(dsi_config);
-       struct drm_device *dev = sender->dev;
-       struct drm_psb_private *dev_priv = dev->dev_private;
+       struct drm_device *dev;
+       struct drm_psb_private *dev_priv;
        u32 gen_ctrl_val;
 
        if (!sender) {
@@ -101,6 +101,9 @@ void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe)
                return;
        }
 
+       dev = sender->dev;
+       dev_priv = dev->dev_private;
+
        /* Set default display backlight value to 85% (0xd8)*/
        mdfld_dsi_send_mcs_short(sender, write_display_brightness, 0xd8, 1,
                                true);
--
Quoted 1 line

1.7.9.5

Your patch has been applied to:
https://github.com/patjak/drm-gma500.git gma500-next

Thanks
Patrik Jakobsson