aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErnesto Ramos <ernesto@ti.com>2010-07-28 17:04:57 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-02 20:11:03 -0400
commit084f70ee096d385e363bd5d309cc7ff24fb98c53 (patch)
tree85b57c2dde0e43182f8a8173a22902cde7b309db
parent4ec09714a0a5861c3e786967024ddfff00b0add6 (diff)
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>
-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,
1527{ 1527{
1528 rcu_read_lock(); 1528 rcu_read_lock();
1529 *strmres = idr_find(((struct process_context *)pr_ctxt)->stream_id, 1529 *strmres = idr_find(((struct process_context *)pr_ctxt)->stream_id,
1530 (int)hstream); 1530 (int)hstream - 1);
1531 rcu_read_unlock(); 1531 rcu_read_unlock();
1532 return; 1532 return;
1533} 1533}
@@ -1724,6 +1724,7 @@ u32 strmwrap_open(union trapped_args *args, void *pr_ctxt)
1724 struct strm_res_object *strm_res_obj; 1724 struct strm_res_object *strm_res_obj;
1725 struct dsp_streamattrin strm_attr_in; 1725 struct dsp_streamattrin strm_attr_in;
1726 struct node_res_object *node_res; 1726 struct node_res_object *node_res;
1727 int strmid;
1727 1728
1728 find_node_handle(&node_res, pr_ctxt, args->args_strm_open.hnode); 1729 find_node_handle(&node_res, pr_ctxt, args->args_strm_open.hnode);
1729 1730
@@ -1745,7 +1746,10 @@ u32 strmwrap_open(union trapped_args *args, void *pr_ctxt)
1745 args->args_strm_open.direction, 1746 args->args_strm_open.direction,
1746 args->args_strm_open.index, &attr, &strm_res_obj, 1747 args->args_strm_open.index, &attr, &strm_res_obj,
1747 pr_ctxt); 1748 pr_ctxt);
1748 CP_TO_USR(args->args_strm_open.ph_stream, &strm_res_obj->id, status, 1); 1749 if (!status) {
1750 strmid = strm_res_obj->id + 1;
1751 CP_TO_USR(args->args_strm_open.ph_stream, &strmid, status, 1);
1752 }
1749 return status; 1753 return status;
1750} 1754}
1751 1755