From patchwork Tue Jan 10 07:01:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhao X-Patchwork-Id: 6135 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3610A23F84 for ; Tue, 10 Jan 2012 07:02:19 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 24AF1A184E3 for ; Tue, 10 Jan 2012 07:02:19 +0000 (UTC) Received: by mail-bk0-f52.google.com with SMTP id zu5so295178bkb.11 for ; Mon, 09 Jan 2012 23:02:19 -0800 (PST) Received: by 10.204.41.143 with SMTP id o15mr4458955bke.63.1326178938861; Mon, 09 Jan 2012 23:02:18 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs74701bkc; Mon, 9 Jan 2012 23:02:18 -0800 (PST) Received: by 10.50.195.227 with SMTP id ih3mr1232267igc.19.1326178937063; Mon, 09 Jan 2012 23:02:17 -0800 (PST) Received: from VA3EHSOBE008.bigfish.com (va3ehsobe001.messaging.microsoft.com. [216.32.180.11]) by mx.google.com with ESMTPS id z9si29257362igi.20.2012.01.09.23.02.16 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 Jan 2012 23:02:17 -0800 (PST) Received-SPF: neutral (google.com: 216.32.180.11 is neither permitted nor denied by best guess record for domain of richard.zhao@linaro.org) client-ip=216.32.180.11; Authentication-Results: mx.google.com; spf=neutral (google.com: 216.32.180.11 is neither permitted nor denied by best guess record for domain of richard.zhao@linaro.org) smtp.mail=richard.zhao@linaro.org Received: from mail141-va3-R.bigfish.com (10.7.14.247) by VA3EHSOBE008.bigfish.com (10.7.40.28) with Microsoft SMTP Server id 14.1.225.23; Tue, 10 Jan 2012 07:02:15 +0000 Received: from mail141-va3 (localhost [127.0.0.1]) by mail141-va3-R.bigfish.com (Postfix) with ESMTP id B68684001AF; Tue, 10 Jan 2012 07:02:15 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275dhz2dhc1ahc1bh87h2a8h668h839h62h) X-Spam-TCS-SCL: 1:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-FB-DOMAIN-IP-MATCH: fail Received: from mail141-va3 (localhost.localdomain [127.0.0.1]) by mail141-va3 (MessageSwitch) id 1326178935402163_30587; Tue, 10 Jan 2012 07:02:15 +0000 (UTC) Received: from VA3EHSMHS016.bigfish.com (unknown [10.7.14.238]) by mail141-va3.bigfish.com (Postfix) with ESMTP id 5A3FA6A0056; Tue, 10 Jan 2012 07:02:15 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS016.bigfish.com (10.7.99.26) with Microsoft SMTP Server (TLS) id 14.1.225.22; Tue, 10 Jan 2012 07:02:07 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server id 14.1.355.3; Tue, 10 Jan 2012 01:02:06 -0600 Received: from b20223-02.ap.freescale.net (b20223-02.ap.freescale.net [10.192.242.124]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id q0A71qKm000113; Tue, 10 Jan 2012 01:02:04 -0600 (CST) From: Richard Zhao To: , CC: , , , , , , Richard Zhao Subject: [PATCH 5/6] dma/imx-sdma: use num_events to validate event_id0 Date: Tue, 10 Jan 2012 15:01:49 +0800 Message-ID: <1326178910-14044-5-git-send-email-richard.zhao@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1326178910-14044-1-git-send-email-richard.zhao@linaro.org> References: <1326178910-14044-1-git-send-email-richard.zhao@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com event number is not always 32. use num_events for checking instead. Signed-off-by: Richard Zhao Acked-by: Shawn Guo --- drivers/dma/imx-sdma.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 015d93f..22fd561 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -723,7 +723,7 @@ static int sdma_config_channel(struct sdma_channel *sdmac) sdmac->per_addr = 0; if (sdmac->event_id0) { - if (sdmac->event_id0 > 32) + if (sdmac->event_id0 >= sdmac->sdma->num_events) return -EINVAL; sdma_event_enable(sdmac, sdmac->event_id0); }