[PATCH] pcmcia: missing pcmcia_get_socket() result check
authorFlorin Malita <fmalita@gmail.com>
Thu, 25 May 2006 01:21:31 +0000 (21:21 -0400)
committerDominik Brodowski <linux@dominikbrodowski.net>
Thu, 1 Jun 2006 22:56:17 +0000 (00:56 +0200)
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@gmail.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
drivers/pcmcia/ds.c

index 48d3b3d30c2169231d6749f7478bab8a0d3b50b9..74b3124e8247e444fd2911eecfe0de1ca5597063 100644 (file)
@@ -1143,6 +1143,12 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
 {
        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);