diff mbox

[1/4] DSPBRIDGE: always malloc strlen+1 for the trailing \0

Message ID 1246544468-14546-1-git-send-email-ameya.palande@nokia.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Ameya Palande July 2, 2009, 2:21 p.m. UTC
From: Phil Carmody <ext-phil.2.carmody@nokia.com>

Array member [pathSize] is set to \0, so the array must be
pathSize+1 bytes in size.

Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
---
 drivers/dsp/bridge/pmgr/wcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Guzman Lugo, Fernando July 3, 2009, 6:42 p.m. UTC | #1
It looks good. Thanks

> -----Original Message-----
> From: Ameya Palande [mailto:ameya.palande@nokia.com]
> Sent: Thursday, July 02, 2009 9:21 AM
> To: linux-omap@vger.kernel.org
> Cc: Guzman Lugo, Fernando; Kanigeri, Hari; ext-phil.2.carmody@nokia.com
> Subject: [PATCH 1/4] DSPBRIDGE: always malloc strlen+1 for the trailing \0
> 
> From: Phil Carmody <ext-phil.2.carmody@nokia.com>
> 
> Array member [pathSize] is set to \0, so the array must be
> pathSize+1 bytes in size.
> 
> Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
> ---
>  drivers/dsp/bridge/pmgr/wcd.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
> index 86812c6..7732492 100644
> --- a/drivers/dsp/bridge/pmgr/wcd.c
> +++ b/drivers/dsp/bridge/pmgr/wcd.c
> @@ -530,7 +530,7 @@ u32 MGRWRAP_RegisterObject(union Trapped_Args *args)
>  		goto func_end;
>  	pathSize = strlen_user((char *)
>  				args->ARGS_MGR_REGISTEROBJECT.pszPathName);
> -	pszPathName = MEM_Alloc(pathSize, MEM_NONPAGED);
> +	pszPathName = MEM_Alloc(pathSize + 1, MEM_NONPAGED);
>  	if (!pszPathName)
>  		goto func_end;
>  	retVal = strncpy_from_user(pszPathName,
> --
> 1.6.2.4
> 

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

--
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/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index 86812c6..7732492 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -530,7 +530,7 @@  u32 MGRWRAP_RegisterObject(union Trapped_Args *args)
 		goto func_end;
 	pathSize = strlen_user((char *)
 				args->ARGS_MGR_REGISTEROBJECT.pszPathName);
-	pszPathName = MEM_Alloc(pathSize, MEM_NONPAGED);
+	pszPathName = MEM_Alloc(pathSize + 1, MEM_NONPAGED);
 	if (!pszPathName)
 		goto func_end;
 	retVal = strncpy_from_user(pszPathName,