Skip to content

Commit

Permalink
staging: tidspbridge/pmgr: additional checking after return from strl…
Browse files Browse the repository at this point in the history
…en_user

  strlen_user will return the length including final NUL.
    and will return 0 if failed (for example: if user string not NUL terminated)

  so need check whether it is an invalid parameter.

addtional info:
  can reference the comments of strlen_user in lib/strnlen_user.c

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Cc: Omar Ramirez Luna <omar.ramirez@copitl.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Chen Gang authored and Greg Kroah-Hartman committed Jan 21, 2013
1 parent cdbbc61 commit ec7e0ae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/staging/tidspbridge/pmgr/dspapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,13 @@ u32 mgrwrap_register_object(union trapped_args *args, void *pr_ctxt)
CP_FM_USR(&uuid_obj, args->args_mgr_registerobject.uuid_obj, status, 1);
if (status)
goto func_end;
/* path_size is increased by 1 to accommodate NULL */
path_size = strlen_user((char *)
args->args_mgr_registerobject.sz_path_name) +
1;
args->args_mgr_registerobject.sz_path_name);
if (!path_size) {
status = -EINVAL;
goto func_end;
}

psz_path_name = kmalloc(path_size, GFP_KERNEL);
if (!psz_path_name) {
status = -ENOMEM;
Expand Down

0 comments on commit ec7e0ae

Please sign in to comment.