[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1280351097-3346-3-git-send-email-ernesto@ti.com>
Date: Wed, 28 Jul 2010 16:04:54 -0500
From: Ernesto Ramos <ernesto@...com>
To: gregkh@...e.de
Cc: omar.ramirez@...com, ohad@...ery.com, ameya.palande@...ia.com,
felipe.contreras@...ia.com, fernando.lugo@...com,
linux-kernel@...r.kernel.org, andy.shevchenko@...il.com, nm@...com,
linux-omap@...r.kernel.org, Ernesto Ramos <ernesto@...com>
Subject: [PATCH] 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@...com>
---
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 6eda7c5..f46aaf6 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,
{
rcu_read_lock();
*noderes = idr_find(((struct process_context *)pr_ctxt)->node_id,
- (int)hnode);
+ (int)hnode - 1);
rcu_read_unlock();
return;
}
@@ -1077,6 +1077,7 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt)
u8 *pargs = NULL;
struct dsp_nodeattrin proc_attr_in, *attr_in = NULL;
struct node_res_object *node_res;
+ int nodeid;
/* Optional argument */
if (psize) {
@@ -1112,7 +1113,8 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt)
attr_in, &node_res, pr_ctxt);
}
if (!status) {
- CP_TO_USR(args->args_node_allocate.ph_node, &node_res->id,
+ nodeid = node_res->id + 1;
+ CP_TO_USR(args->args_node_allocate.ph_node, &nodeid,
status, 1);
if (status) {
status = -EFAULT;
--
1.5.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists