devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: busses: i2c-pxa.c:  Fix for possible null pointer dereference
@ 2014-05-17 17:14 Rickard Strandqvist
       [not found] ` <1400346848-25098-1-git-send-email-rickard_strandqvist-IW2WV5XWFqGZkjO+N0TKoMugMpMbD5Xr@public.gmane.org>
  0 siblings, 1 reply; 5+ 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-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

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-IW2WV5XWFqGZkjO+N0TKoMugMpMbD5Xr@public.gmane.org>
---
 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] 5+ messages in thread

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

Thread overview: 5+ 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
     [not found] ` <1400346848-25098-1-git-send-email-rickard_strandqvist-IW2WV5XWFqGZkjO+N0TKoMugMpMbD5Xr@public.gmane.org>
2014-05-17 17:18   ` Mateusz Guzik
2014-06-01 20:26   ` Wolfram Sang
2014-06-02  1:55     ` Jingoo Han
2014-06-02 10:15       ` Rickard Strandqvist

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