From: Leo Kim Date: Tue, 22 Sep 2015 05:34:43 +0000 (+0900) Subject: staging: wilc1000: Modify null check routine X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=234837decbffdb28325588f66811796698d68cf2;p=openwrt%2Fstaging%2Fblogic.git staging: wilc1000: Modify null check routine 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 Signed-off-by: Glen Lee Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 62f4a8a08cde..158d8b898b75 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -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]);