From: Omar Ramirez Luna <omar.ramirez@ti.com>
To: linux-omap <linux-omap@vger.kernel.org>
Cc: Ameya Palande <ameya.palande@nokia.com>,
Hiroshi Doyu <Hiroshi.DOYU@nokia.com>,
Felipe Contreras <felipe.contreras@nokia.com>,
Nishanth Menon <nm@ti.com>,
Omar Ramirez Luna <omar.ramirez@ti.com>
Subject: [PATCH 2/2] DSPBRIDGE: check pointer before dereference
Date: Thu, 18 Feb 2010 15:55:34 -0600 [thread overview]
Message-ID: <1266530134-8186-3-git-send-email-omar.ramirez@ti.com> (raw)
In-Reply-To: <1266530134-8186-2-git-send-email-omar.ramirez@ti.com>
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@ti.com>
---
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
next prev parent reply other threads:[~2010-02-18 21:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-18 21:55 [PATCH 0/2] DSPBRIDGE: unrelated fixes Omar Ramirez Luna
2010-02-18 21:55 ` [PATCH 1/2] DSPBRIDGE: logic error fix for SleepDSP timeout value Omar Ramirez Luna
2010-02-18 21:55 ` Omar Ramirez Luna [this message]
2010-02-24 2:11 ` [PATCH 2/2] DSPBRIDGE: check pointer before dereference Omar Ramirez Luna
2010-02-24 2:11 ` [PATCH 1/2] DSPBRIDGE: logic error fix for SleepDSP timeout value Omar Ramirez Luna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1266530134-8186-3-git-send-email-omar.ramirez@ti.com \
--to=omar.ramirez@ti.com \
--cc=Hiroshi.DOYU@nokia.com \
--cc=ameya.palande@nokia.com \
--cc=felipe.contreras@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox