RE: [PATCH 3/8] DSPBRIDGE: Check input value

2009-08-31 Thread Guzman Lugo, Fernando

Hi,
Good finding.

Acked-by: Fernando Guzman Lugo x0095...@ti.com


-Original Message-
From: linux-omap-ow...@vger.kernel.org [mailto:linux-omap-
ow...@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.shevche...@nokia.com

Check input value before dereferencing it.

Signed-off-by: Andy Shevchenko ext-andriy.shevche...@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 majord...@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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8] DSPBRIDGE: Check input value

2009-08-27 Thread Andy Shevchenko
From: Andy Shevchenko ext-andriy.shevche...@nokia.com

Check input value before dereferencing it.

Signed-off-by: Andy Shevchenko ext-andriy.shevche...@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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html