From patchwork Wed Jul 28 21:04:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ramos Falcon, Ernesto" X-Patchwork-Id: 114905 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6SL1BnR013193 for ; Wed, 28 Jul 2010 21:01:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756260Ab0G1VA1 (ORCPT ); Wed, 28 Jul 2010 17:00:27 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:33813 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752580Ab0G1VAY (ORCPT ); Wed, 28 Jul 2010 17:00:24 -0400 Received: from dlep35.itg.ti.com ([157.170.170.118]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id o6SL0AkH013764 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Jul 2010 16:00:10 -0500 Received: from emcc1.sasken-mty.naucm.ext.ti.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id o6SL09MR017045; Wed, 28 Jul 2010 16:00:09 -0500 (CDT) Received: from localhost.localdomain (x0076199-desktop.sasken-mty.naucm.ext.ti.com [10.87.230.107]) by emcc1.sasken-mty.naucm.ext.ti.com (8.13.8+Sun/8.13.8) with ESMTP id o6SL06xZ017327; Wed, 28 Jul 2010 16:00:09 -0500 (CDT) From: Ernesto Ramos To: gregkh@suse.de Cc: omar.ramirez@ti.com, ohad@wizery.com, ameya.palande@nokia.com, felipe.contreras@nokia.com, fernando.lugo@ti.com, linux-kernel@vger.kernel.org, andy.shevchenko@gmail.com, nm@ti.com, linux-omap@vger.kernel.org, Ernesto Ramos Subject: [PATCH] staging:ti dspbridge: avoid errors if node handle is zero Date: Wed, 28 Jul 2010 16:04:54 -0500 Message-Id: <1280351097-3346-3-git-send-email-ernesto@ti.com> X-Mailer: git-send-email 1.5.4.5 In-Reply-To: <1280351097-3346-2-git-send-email-ernesto@ti.com> References: <1280351097-3346-1-git-send-email-ernesto@ti.com> <1280351097-3346-2-git-send-email-ernesto@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 28 Jul 2010 21:01:11 +0000 (UTC) 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;