summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorErnesto Ramos2010-07-28 23:04:57 +0200
committerGreg Kroah-Hartman2010-08-03 02:11:03 +0200
commit084f70ee096d385e363bd5d309cc7ff24fb98c53 (patch)
tree85b57c2dde0e43182f8a8173a22902cde7b309db /drivers/staging
parentstaging: ti dspbridge: use stream id instead of kernel address (diff)
downloadkernel-qcow2-linux-084f70ee096d385e363bd5d309cc7ff24fb98c53.tar.gz
kernel-qcow2-linux-084f70ee096d385e363bd5d309cc7ff24fb98c53.tar.xz
kernel-qcow2-linux-084f70ee096d385e363bd5d309cc7ff24fb98c53.zip
staging: ti dspbridge: avoid errors if stream id is zero
As 'zero' can be a perfectly good id, it can be picked up as a NULL from userspace, avoid issues in API and user apps if stream handle is zero. Signed-off-by: Ernesto Ramos <ernesto@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/tidspbridge/pmgr/dspapi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 47892dd47388..7b42f72a97b2 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -1527,7 +1527,7 @@ inline void find_strm_handle(struct strm_res_object **strmres,
{
rcu_read_lock();
*strmres = idr_find(((struct process_context *)pr_ctxt)->stream_id,
- (int)hstream);
+ (int)hstream - 1);
rcu_read_unlock();
return;
}
@@ -1724,6 +1724,7 @@ u32 strmwrap_open(union trapped_args *args, void *pr_ctxt)
struct strm_res_object *strm_res_obj;
struct dsp_streamattrin strm_attr_in;
struct node_res_object *node_res;
+ int strmid;
find_node_handle(&node_res, pr_ctxt, args->args_strm_open.hnode);
@@ -1745,7 +1746,10 @@ u32 strmwrap_open(union trapped_args *args, void *pr_ctxt)
args->args_strm_open.direction,
args->args_strm_open.index, &attr, &strm_res_obj,
pr_ctxt);
- CP_TO_USR(args->args_strm_open.ph_stream, &strm_res_obj->id, status, 1);
+ if (!status) {
+ strmid = strm_res_obj->id + 1;
+ CP_TO_USR(args->args_strm_open.ph_stream, &strmid, status, 1);
+ }
return status;
}