Return-path: Received: from eusmtp01.atmel.com ([212.144.249.242]:28192 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750757AbbIVFc1 (ORCPT ); Tue, 22 Sep 2015 01:32:27 -0400 From: Glen Lee To: CC: , , , , , , , , , , , Subject: [PATCH v3 1/4] staging: wilc1000: Modify null check routine Date: Tue, 22 Sep 2015 14:34:43 +0900 Message-ID: <1442900086-9480-1-git-send-email-glen.lee@atmel.com> (sfid-20150922_073231_099947_21F04ADA) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-wireless-owner@vger.kernel.org List-ID: From: Leo Kim 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 --- drivers/staging/wilc1000/host_interface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 62f4a8a..158d8b8 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]); -- 1.9.1