[PATCH 2/2] DSPBRIDGE: check pointer before dereference

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

 



Change the check for valid handle to detect a possible
error, and now use it before dereferencing the pointer.

Signed-off-by: Omar Ramirez Luna <omar.ramirez@xxxxxx>
---
 drivers/dsp/bridge/pmgr/msg.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/dsp/bridge/pmgr/msg.c b/drivers/dsp/bridge/pmgr/msg.c
index 5cfeb5b..9e4b202 100644
--- a/drivers/dsp/bridge/pmgr/msg.c
+++ b/drivers/dsp/bridge/pmgr/msg.c
@@ -104,19 +104,19 @@ void MSG_Delete(struct MSG_MGR *hMsgMgr)
 	struct WMD_DRV_INTERFACE *pIntfFxns;
 
 	DBC_Require(cRefs > 0);
-	DBC_Require(MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE));
 
 	GT_1trace(MSG_debugMask, GT_ENTER, "MSG_Delete: hMsgMgr: 0x%x\n",
 		 hMsgMgr);
 
-	pIntfFxns = pMsgMgr->pIntfFxns;
+	if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE)) {
+		pIntfFxns = pMsgMgr->pIntfFxns;
 
-	/* Let WMD message module destroy the MSG_MGR: */
-	(*pIntfFxns->pfnMsgDelete)(hMsgMgr);
-
-	if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
-		GT_1trace(MSG_debugMask, GT_7CLASS, "MSG_Delete: Error hMsgMgr "
-					"Valid Handle: 0x%x\n", hMsgMgr);
+		/* Let WMD message module destroy the MSG_MGR: */
+		(*pIntfFxns->pfnMsgDelete)(hMsgMgr);
+	} else {
+		GT_1trace(MSG_debugMask, GT_7CLASS, "MSG_Delete: Error hMsgMgr"
+					"invalid Handle: 0x%x\n", hMsgMgr);
+	}
 }
 
 /*
-- 
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux