lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 08 Jul 2011 09:43:15 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	greg@...ah.com, linux-kernel@...r.kernel.org
Subject: [PATCH 02/12] gma500: Re-order checks and dereferences in
 psb_intel_lvds

From: Alan Cox <alan@...ux.intel.com>

Dan Carpenter reports:

Smatch complains about 6a7afe3acc4b "gma500: continue abstracting
platform specific code"

drivers/staging/gma500/psb_intel_lvds.c +579 psb_intel_lvds_set_property(7)
	warn: variable dereferenced before check 'encoder'

--- a/drivers/staging/gma500/psb_intel_lvds.c
+++ b/drivers/staging/gma500/psb_intel_lvds.c
@@ -575,11 +575,12 @@ int psb_intel_lvds_set_property(struct drm_connector
*connector,
                                       struct drm_property *property,
                                       uint64_t value)
 {
-       struct drm_encoder *pEncoder = connector->encoder;
+       struct drm_encoder *encoder = connector->encoder;
+       struct drm_psb_private *dev_priv = encoder->dev->dev_private;
                                           ^^^^^^^^^^^^
dereference encoder here.

Signed-off-by: Alan Cox <alan@...ux.intel.com>
---

 drivers/staging/gma500/psb_intel_lvds.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gma500/psb_intel_lvds.c b/drivers/staging/gma500/psb_intel_lvds.c
index 4a0d234..1e1e788 100644
--- a/drivers/staging/gma500/psb_intel_lvds.c
+++ b/drivers/staging/gma500/psb_intel_lvds.c
@@ -574,9 +574,14 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
 				       uint64_t value)
 {
 	struct drm_encoder *encoder = connector->encoder;
-	struct drm_psb_private *dev_priv = encoder->dev->dev_private;
+	struct drm_psb_private *dev_priv;
+	
+	if (!encoder)
+	        return -1;
 
-	if (!strcmp(property->name, "scaling mode") && encoder) {
+	dev_priv = encoder->dev->dev_private;
+
+	if (!strcmp(property->name, "scaling mode")) {
 		struct psb_intel_crtc *pPsbCrtc =
 					to_psb_intel_crtc(encoder->crtc);
 		uint64_t curValue;
@@ -617,7 +622,7 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
 						      encoder->crtc->fb))
 				goto set_prop_error;
 		}
-	} else if (!strcmp(property->name, "backlight") && encoder) {
+	} else if (!strcmp(property->name, "backlight")) {
 		if (drm_connector_property_set_value(connector,
 							property,
 							value))
@@ -631,7 +636,7 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
                         }
 #endif
 		}
-	} else if (!strcmp(property->name, "DPMS") && encoder) {
+	} else if (!strcmp(property->name, "DPMS")) {
 		struct drm_encoder_helper_funcs *pEncHFuncs
 						= encoder->helper_private;
 		pEncHFuncs->dpms(encoder, value);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ