[PATCH 9/9 V2] staging: rtl8192e: Fix various problems noted by smatch

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

 



Smatch reports the following problems:

  CHECK   drivers/staging/rtl8192e/rtllib_softmac.c
drivers/staging/rtl8192e/rtllib_softmac.c +3143 rtllib_softmac_free(4) info: redundant null check on ieee->pDot11dInfo calling kfree()

  CHECK   drivers/staging/rtl8192e/rtllib_module.c
drivers/staging/rtl8192e/rtllib_module.c +198 free_rtllib(6) info: redundant null check on ieee->pHTInfo calling kfree()

  CHECK   drivers/staging/rtl8192e/rtl819x_TSProc.c
drivers/staging/rtl8192e/rtl819x_TSProc.c +280 SearchAdmitTRStream(52) error: potential null derefence 'pRet'.

Signed-off-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx>
---

V2 - fix type in commit message
---

 drivers/staging/rtl8192e/rtl819x_TSProc.c |    2 +-
 drivers/staging/rtl8192e/rtllib_module.c  |    7 +++----
 drivers/staging/rtl8192e/rtllib_softmac.c |    6 ++----
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c
index 5323a9c..09a602f 100644
--- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
@@ -277,7 +277,7 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee,
 			break;
 	}
 
-	if (&pRet->List  != psearch_list)
+	if (pRet && &pRet->List  != psearch_list)
 		return pRet ;
 	else
 		return NULL;
diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c
index 0fe67a5..c36a140 100644
--- a/drivers/staging/rtl8192e/rtllib_module.c
+++ b/drivers/staging/rtl8192e/rtllib_module.c
@@ -194,10 +194,9 @@ void free_rtllib(struct net_device *dev)
 	struct rtllib_device *ieee = (struct rtllib_device *)
 				      netdev_priv_rsl(dev);
 	int i;
-	if (ieee->pHTInfo != NULL) {
-		kfree(ieee->pHTInfo);
-		ieee->pHTInfo = NULL;
-	}
+
+	kfree(ieee->pHTInfo);
+	ieee->pHTInfo = NULL;
 	rtllib_softmac_free(ieee);
 	del_timer_sync(&ieee->crypt_deinit_timer);
 	rtllib_crypt_deinit_entries(ieee, 1);
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index a420ed1..b508685 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -3139,10 +3139,8 @@ void rtllib_softmac_init(struct rtllib_device *ieee)
 void rtllib_softmac_free(struct rtllib_device *ieee)
 {
 	down(&ieee->wx_sem);
-	if (NULL != ieee->pDot11dInfo) {
-		kfree(ieee->pDot11dInfo);
-		ieee->pDot11dInfo = NULL;
-	}
+	kfree(ieee->pDot11dInfo);
+	ieee->pDot11dInfo = NULL;
 	del_timer_sync(&ieee->associate_timer);
 
 	cancel_delayed_work(&ieee->associate_retry_wq);
-- 
1.7.3.4

_______________________________________________
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