From: Sudip Mukherjee Date: Fri, 14 Aug 2015 16:27:51 +0000 (+0530) Subject: staging: rtl8188eu: fix possible NULL dereference X-Git-Tag: firefly_0821_release~176^2~1221^2~33 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f1126b1d0d7c0daf48f50e566c498912b31c459f;p=firefly-linux-kernel-4.4.55.git staging: rtl8188eu: fix possible NULL dereference dm_odm was being checked for NULL after dereferencing it. Lets check for NULL first before derefenrencing it. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c index 15a176596305..2633a13b4e58 100644 --- a/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c +++ b/drivers/staging/rtl8188eu/hal/Hal8188ERateAdaptive.c @@ -659,11 +659,11 @@ void ODM_RA_UpdateRateInfo_8188E(struct odm_dm_struct *dm_odm, u8 macid, u8 Rate { struct odm_ra_info *pRaInfo = NULL; + if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM)) + return; ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_LOUD, ("macid =%d RateID = 0x%x RateMask = 0x%x SGIEnable =%d\n", macid, RateID, RateMask, SGIEnable)); - if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM)) - return; pRaInfo = &(dm_odm->RAInfo[macid]); pRaInfo->RateID = RateID; @@ -676,10 +676,10 @@ void ODM_RA_SetRSSI_8188E(struct odm_dm_struct *dm_odm, u8 macid, u8 Rssi) { struct odm_ra_info *pRaInfo = NULL; - ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, - (" macid =%d Rssi =%d\n", macid, Rssi)); if ((NULL == dm_odm) || (macid >= ASSOCIATE_ENTRY_NUM)) return; + ODM_RT_TRACE(dm_odm, ODM_COMP_RATE_ADAPTIVE, ODM_DBG_TRACE, + (" macid =%d Rssi =%d\n", macid, Rssi)); pRaInfo = &(dm_odm->RAInfo[macid]); pRaInfo->RssiStaRA = Rssi;