diff mbox

[3/8] DSPBRIDGE: Check input value

Message ID 1251375541-1866-4-git-send-email-andy.shevchenko@gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Andy Shevchenko Aug. 27, 2009, 12:18 p.m. UTC
From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>

Check input value before dereferencing it.

Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
---
 drivers/dsp/bridge/wmd/tiomap3430.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Comments

Guzman Lugo, Fernando Aug. 31, 2009, 8:14 p.m. UTC | #1
Hi,
	Good finding.

	Acked-by: Fernando Guzman Lugo <x0095840@ti.com>


>-----Original Message-----
>From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
>owner@vger.kernel.org] On Behalf Of Andy Shevchenko
>Sent: Thursday, August 27, 2009 7:19 AM
>To: linux-omap@vger.kernel.org
>Cc: Andy Shevchenko
>Subject: [PATCH 3/8] DSPBRIDGE: Check input value
>
>From: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
>
>Check input value before dereferencing it.
>
>Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
>---
> drivers/dsp/bridge/wmd/tiomap3430.c |    7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c
>b/drivers/dsp/bridge/wmd/tiomap3430.c
>index db48c49..4cb78c7 100644
>--- a/drivers/dsp/bridge/wmd/tiomap3430.c
>+++ b/drivers/dsp/bridge/wmd/tiomap3430.c
>@@ -1266,11 +1266,16 @@ static DSP_STATUS WMD_DEV_Destroy(struct
>WMD_DEV_CONTEXT *hDevContext)
> 	DSP_STATUS status = DSP_SOK;
> 	struct WMD_DEV_CONTEXT *pDevContext = (struct WMD_DEV_CONTEXT *)
> 						hDevContext;
>+
>+	/* It should never happen */
>+	if (!hDevContext)
>+		return DSP_EHANDLE;
>+
> 	DBG_Trace(DBG_ENTER, "Entering WMD_DEV_Destroy:n hDevContext
>::0x%x\n",
> 		  hDevContext);
> 	/* first put the device to stop state */
> 	WMD_BRD_Delete(pDevContext);
>-	if (pDevContext && pDevContext->pPtAttrs) {
>+	if (pDevContext->pPtAttrs) {
> 		pPtAttrs = pDevContext->pPtAttrs;
> 		if (pPtAttrs->hCSObj)
> 			SYNC_DeleteCS(pPtAttrs->hCSObj);
>--
>1.5.6.5
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

Patch

diff --git a/drivers/dsp/bridge/wmd/tiomap3430.c b/drivers/dsp/bridge/wmd/tiomap3430.c
index db48c49..4cb78c7 100644
--- a/drivers/dsp/bridge/wmd/tiomap3430.c
+++ b/drivers/dsp/bridge/wmd/tiomap3430.c
@@ -1266,11 +1266,16 @@  static DSP_STATUS WMD_DEV_Destroy(struct WMD_DEV_CONTEXT *hDevContext)
 	DSP_STATUS status = DSP_SOK;
 	struct WMD_DEV_CONTEXT *pDevContext = (struct WMD_DEV_CONTEXT *)
 						hDevContext;
+
+	/* It should never happen */
+	if (!hDevContext)
+		return DSP_EHANDLE;
+
 	DBG_Trace(DBG_ENTER, "Entering WMD_DEV_Destroy:n hDevContext ::0x%x\n",
 		  hDevContext);
 	/* first put the device to stop state */
 	WMD_BRD_Delete(pDevContext);
-	if (pDevContext && pDevContext->pPtAttrs) {
+	if (pDevContext->pPtAttrs) {
 		pPtAttrs = pDevContext->pPtAttrs;
 		if (pPtAttrs->hCSObj)
 			SYNC_DeleteCS(pPtAttrs->hCSObj);