From patchwork Thu Jan 21 05:45:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 74205 X-Patchwork-Delegate: omar.ramirez@ti.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0L5jQaf006446 for ; Thu, 21 Jan 2010 05:45:26 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751526Ab0AUFpY (ORCPT ); Thu, 21 Jan 2010 00:45:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752073Ab0AUFpX (ORCPT ); Thu, 21 Jan 2010 00:45:23 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:46607 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752000Ab0AUFpW (ORCPT ); Thu, 21 Jan 2010 00:45:22 -0500 Received: from dlep35.itg.ti.com ([157.170.170.118]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id o0L5jIji001193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 20 Jan 2010 23:45:18 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id o0L5jHaT011895; Wed, 20 Jan 2010 23:45:17 -0600 (CST) Received: from senorita (senorita.am.dhcp.ti.com [128.247.75.1]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id o0L5jHZ17687; Wed, 20 Jan 2010 23:45:17 -0600 (CST) Received: by senorita (Postfix, from userid 1000) id F327DC1F8; Wed, 20 Jan 2010 23:45:16 -0600 (CST) From: Nishanth Menon To: linux-omap Cc: Nishanth Menon , Ameya Palande , Deepak Chitriki , Felipe Contreras , Hiroshi Doyu , Omar Ramirez Luna Subject: [PATCH 2/2] DSPBRIDGE: sanitize opp_idx before passing to PM Date: Wed, 20 Jan 2010 23:45:10 -0600 Message-Id: <1264052710-30337-3-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1264052710-30337-2-git-send-email-nm@ti.com> References: <[PATCH 1/2] DSPBRIDGE: remove dependency of mpu freq> <1264052710-30337-1-git-send-email-nm@ti.com> <1264052710-30337-2-git-send-email-nm@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c index 5dfbef8..a13e035 100644 --- a/drivers/dsp/bridge/wmd/tiomap3430_pwr.c +++ b/drivers/dsp/bridge/wmd/tiomap3430_pwr.c @@ -73,6 +73,12 @@ DSP_STATUS handle_constraints_set(struct WMD_DEV_CONTEXT *pDevContext, /* pick up the opp index */ opp_idx = *(((u32 *)(pArgs)) + 1); + /* Sanity check to ensure things are fine */ + if (!opp_idx || (opp_idx > pdata->dsp_num_speeds)) { + pr_err("%s: DSP requested for an invalid OPP %d Vs %d->%d!\n", + __func__, opp_idx, 1, pdata->dsp_num_speeds); + return DSP_EINVALIDARG; + } /* Read the target value requested by DSP */ DBG_Trace(DBG_LEVEL7, "handle_constraints_set:" "opp requested = 0x%x\n", opp_idx);