[PATCH 5/8] Staging: ipack/bridges/tpci200: check if the remove function is available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To avoid a dereference of a NULL pointer, the availability of the function is
checked before its use.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@xxxxxxxxxx>
---
 drivers/staging/ipack/bridges/tpci200.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/ipack/bridges/tpci200.c b/drivers/staging/ipack/bridges/tpci200.c
index 0c2a50a..ee26d9a 100644
--- a/drivers/staging/ipack/bridges/tpci200.c
+++ b/drivers/staging/ipack/bridges/tpci200.c
@@ -764,6 +764,8 @@ out:
 static void tpci200_slot_remove(struct tpci200_slot *slot)
 {
 	if ((slot->dev == NULL) ||
+	    (slot->dev->driver == NULL) ||
+	    (slot->dev->driver->ops == NULL) ||
 	    (slot->dev->driver->ops->remove == NULL))
 		return;
 
-- 
1.7.10

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux