staging: wilc1000: Modify null check routine
authorLeo Kim <leo.kim@atmel.com>
Tue, 22 Sep 2015 05:34:43 +0000 (14:34 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 00:27:01 +0000 (02:27 +0200)
This patch removes the potential faults which may happen when unexpectedly
getting access to invalid pointer. Return error when the invalid memory is
accessed.

Signed-off-by: Leo Kim <leo.kim@atmel.com>
Signed-off-by: Glen Lee <glen.lee@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wilc1000/host_interface.c

index 62f4a8a08cde6e7db7bd9202c8f6e21907608f71..158d8b898b7551896276cce6c51ea9535038d957 100644 (file)
@@ -2384,8 +2384,10 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler,
        s32 s32Err = 0;
        tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler;
 
-       if (pstrWFIDrv == NULL)
+       if (!pstrWFIDrv) {
                PRINT_ER("Driver handler is NULL\n");
+               return -ENODEV;
+       }
        PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate,
                pstrRcvdGnrlAsyncInfo->pu8Buffer[7]);