linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Input: cyttsp - Fix check after pointer dereferencing
@ 2012-02-10  1:18 Javier Martinez Canillas
  2012-02-10  1:18 ` [PATCH 2/2] MAINTAINERS: Add cyttsp touchscreen maintainer entry Javier Martinez Canillas
  0 siblings, 1 reply; 2+ messages in thread
From: Javier Martinez Canillas @ 2012-02-10  1:18 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Dan Carpenter, linux-input, Javier Martinez Canillas

From: Javier Martinez Canillas <martinez.javier@dowhile0.org>

In the cyttsp_probe() function the struct device *dev pointer was
dereferenced before checking if it was NULL.

Now dev is never NULL since both I2C and SPI bus drivers pass a pointer to a
member of an previously allocated structure. But others bus drivers can do
it differently so is better to sanity check instead of trust in the callers.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
---
 drivers/input/touchscreen/cyttsp_core.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c
index 8be2247..071e5ae8 100644
--- a/drivers/input/touchscreen/cyttsp_core.c
+++ b/drivers/input/touchscreen/cyttsp_core.c
@@ -518,12 +518,19 @@ static void cyttsp_close(struct input_dev *dev)
 struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
 			    struct device *dev, int irq, size_t xfer_buf_size)
 {
-	const struct cyttsp_platform_data *pdata = dev->platform_data;
+	const struct cyttsp_platform_data *pdata;
 	struct cyttsp *ts;
 	struct input_dev *input_dev;
 	int error;
 
-	if (!dev || !bus_ops || !pdata || !pdata->name || irq <= 0) {
+	if (!dev || !bus_ops || !dev->platform_data || irq <= 0) {
+		error = -EINVAL;
+		goto err_out;
+	}
+
+	pdata = dev->platform_data;
+
+	if (!pdata->name) {
 		error = -EINVAL;
 		goto err_out;
 	}
-- 
1.7.7.6


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

* [PATCH 2/2] MAINTAINERS: Add cyttsp touchscreen maintainer entry
  2012-02-10  1:18 [PATCH 1/2] Input: cyttsp - Fix check after pointer dereferencing Javier Martinez Canillas
@ 2012-02-10  1:18 ` Javier Martinez Canillas
  0 siblings, 0 replies; 2+ messages in thread
From: Javier Martinez Canillas @ 2012-02-10  1:18 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Dan Carpenter, linux-input, Javier Martinez Canillas

Since Cypress TTSP driver was merged in mainline, add a maintainer entry for it.

Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
---
 MAINTAINERS |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3523ab0..5fa8732 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2110,6 +2110,13 @@ W:	http://www.cyclades.com/
 S:	Orphan
 F:	drivers/net/wan/pc300*
 
+CYTTSP TOUCHSCREEN DRIVER
+M:      Javier Martinez Canillas <javier@dowhile0.org>
+L:      linux-input@vger.kernel.org
+S:      Maintained
+F:      drivers/input/touchscreen/cyttsp*
+F:      include/linux/input/cyttsp.h
+
 DAMA SLAVE for AX.25
 M:	Joerg Reuter <jreuter@yaina.de>
 W:	http://yaina.de/jreuter/
-- 
1.7.7.6


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

end of thread, other threads:[~2012-02-10  1:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-10  1:18 [PATCH 1/2] Input: cyttsp - Fix check after pointer dereferencing Javier Martinez Canillas
2012-02-10  1:18 ` [PATCH 2/2] MAINTAINERS: Add cyttsp touchscreen maintainer entry Javier Martinez Canillas

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).