diff options
author | Ernesto Ramos <ernesto@ti.com> | 2010-07-28 17:04:54 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-02 20:11:02 -0400 |
commit | 8df327c3904d34527b89d4881bd3ce2966f0e07f (patch) | |
tree | a0a3e490dbfa07bffb1846ca1473fb52bde9bec2 /drivers/staging | |
parent | 0624f52f77e11a6edfc48827a12190f874d572b8 (diff) |
staging: ti dspbridge: avoid errors if node handle 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 node
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.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c index 6eda7c5324a8..f46aaf683e37 100644 --- a/drivers/staging/tidspbridge/pmgr/dspapi.c +++ b/drivers/staging/tidspbridge/pmgr/dspapi.c | |||
@@ -1059,7 +1059,7 @@ inline void find_node_handle(struct node_res_object **noderes, | |||
1059 | { | 1059 | { |
1060 | rcu_read_lock(); | 1060 | rcu_read_lock(); |
1061 | *noderes = idr_find(((struct process_context *)pr_ctxt)->node_id, | 1061 | *noderes = idr_find(((struct process_context *)pr_ctxt)->node_id, |
1062 | (int)hnode); | 1062 | (int)hnode - 1); |
1063 | rcu_read_unlock(); | 1063 | rcu_read_unlock(); |
1064 | return; | 1064 | return; |
1065 | } | 1065 | } |
@@ -1077,6 +1077,7 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt) | |||
1077 | u8 *pargs = NULL; | 1077 | u8 *pargs = NULL; |
1078 | struct dsp_nodeattrin proc_attr_in, *attr_in = NULL; | 1078 | struct dsp_nodeattrin proc_attr_in, *attr_in = NULL; |
1079 | struct node_res_object *node_res; | 1079 | struct node_res_object *node_res; |
1080 | int nodeid; | ||
1080 | 1081 | ||
1081 | /* Optional argument */ | 1082 | /* Optional argument */ |
1082 | if (psize) { | 1083 | if (psize) { |
@@ -1112,7 +1113,8 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt) | |||
1112 | attr_in, &node_res, pr_ctxt); | 1113 | attr_in, &node_res, pr_ctxt); |
1113 | } | 1114 | } |
1114 | if (!status) { | 1115 | if (!status) { |
1115 | CP_TO_USR(args->args_node_allocate.ph_node, &node_res->id, | 1116 | nodeid = node_res->id + 1; |
1117 | CP_TO_USR(args->args_node_allocate.ph_node, &nodeid, | ||
1116 | status, 1); | 1118 | status, 1); |
1117 | if (status) { | 1119 | if (status) { |
1118 | status = -EFAULT; | 1120 | status = -EFAULT; |