[patch 1/2] pcmcia: missing pcmcia_get_socket() result check

Dominik Brodowski linux at dominikbrodowski.net
Sun Jun 4 10:33:13 EDT 2006


From: Florin Malita <fmalita at gmail.com>
Date: Wed, 24 May 2006 21:21:31 -0400
Subject: [PATCH] pcmcia: missing pcmcia_get_socket() result check

The result of pcmcia_get_socket() may be NULL but ds_event() uses it
without checking.

Coverity CID: 436.

Signed-off-by: Florin Malita <fmalita at gmail.com>
Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>

---

 drivers/pcmcia/ds.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

1617406a763870a84ffe6bba3659f30f96ac4a61
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 48d3b3d..74b3124 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -1143,6 +1143,12 @@ static int ds_event(struct pcmcia_socket
 {
 	struct pcmcia_socket *s = pcmcia_get_socket(skt);
 
+	if (!s) {
+		printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \
+			"failed, event 0x%x lost!\n", skt, event);
+		return -ENODEV;
+	}
+
 	ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n",
 	       event, priority, skt);
 
-- 
1.3.3




More information about the linux-pcmcia mailing list