public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: busses: i2c-pxa.c:  Fix for possible null pointer dereference
@ 2014-05-17 17:14 Rickard Strandqvist
  2014-05-17 17:18 ` Mateusz Guzik
  2014-06-01 20:26 ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Rickard Strandqvist @ 2014-05-17 17:14 UTC (permalink / raw)
  To: Wolfram Sang, Grant Likely
  Cc: Rickard Strandqvist, Rob Herring, Jingoo Han, Leilei Shang,
	Daniel Drake, linux-i2c, linux-kernel, devicetree

There is otherwise a risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/i2c/busses/i2c-pxa.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index bbe6dfb..dbe5ebe 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1269,7 +1269,9 @@ eremap:
 eclk:
 	kfree(i2c);
 emalloc:
-	release_mem_region(res->start, resource_size(res));
+	if(res) {
+		release_mem_region(res->start, resource_size(res));
+	}
 	return ret;
 }
 
-- 
1.7.10.4


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

end of thread, other threads:[~2014-06-02  1:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-17 17:14 [PATCH] i2c: busses: i2c-pxa.c: Fix for possible null pointer dereference Rickard Strandqvist
2014-05-17 17:18 ` Mateusz Guzik
2014-06-01 20:26 ` Wolfram Sang
2014-06-02  1:55   ` Jingoo Han

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