[PATCH 2/5] DSPBRIDGE: Avoid errors if node handle is zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 827cbf0b4ade7ec7839b503922ecb278df1ff233 Mon Sep 17 00:00:00 2001
From: Ernesto Ramos <ernesto@xxxxxx>
Date: Fri, 16 Apr 2010 18:22:36 -0500
Subject: [PATCH 2/5] 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@xxxxxx>
---
 drivers/dsp/bridge/pmgr/wcd.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/dsp/bridge/pmgr/wcd.c b/drivers/dsp/bridge/pmgr/wcd.c
index 20e02f1..d51798a 100644
--- a/drivers/dsp/bridge/pmgr/wcd.c
+++ b/drivers/dsp/bridge/pmgr/wcd.c
@@ -1028,7 +1028,7 @@ inline void find_node_handle(struct node_res_object **noderes,
 {
 	rcu_read_lock();
 	*noderes = idr_find(((struct process_context *)pr_ctxt)->node_idp,
-								(int)hnode);
+								(int)hnode - 1);
 	rcu_read_unlock();
 	return;
 }
@@ -1086,6 +1086,8 @@ u32 nodewrap_allocate(union Trapped_Args *args, void *pr_ctxt)
 		if (DSP_FAILED(status)) {
 			status = DSP_EPOINTER;
 			node_delete(node_res, pr_ctxt);
+		} else {
+			*args->args_node_allocate.ph_node += 1;
 		}
 	}
 func_cont:
-- 
1.5.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux