mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vincent Stehlé" <vincent.stehle@laposte.net>
To: dmaengine@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	"Vincent Stehlé" <vincent.stehle@laposte.net>,
	"Zhangfei Gao" <zhangfei.gao@linaro.org>,
	"Vinod Koul" <vinod.koul@intel.com>,
	stable@vger.kernel.org
Subject: [PATCH] dmaengine: k3dma: fix off by one
Date: Wed, 21 Sep 2016 22:16:55 +0200	[thread overview]
Message-ID: <20160921201655.19674-1-vincent.stehle@laposte.net> (raw)

In k3_of_dma_simple_xlate(), the d->chans[] array has d->dma_requests
elements so > should be >=.

Fixes: 8e6152bc660e69f5 ("dmaengine: Add hisilicon k3 DMA engine driver")
Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: stable@vger.kernel.org
---
 drivers/dma/k3dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index aabcb79..cd7f67b 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -792,7 +792,7 @@ static struct dma_chan *k3_of_dma_simple_xlate(struct of_phandle_args *dma_spec,
 	struct k3_dma_dev *d = ofdma->of_dma_data;
 	unsigned int request = dma_spec->args[0];
 
-	if (request > d->dma_requests)
+	if (request >= d->dma_requests)
 		return NULL;
 
 	return dma_get_slave_channel(&(d->chans[request].vc.chan));
-- 
2.9.3

             reply	other threads:[~2016-09-21 20:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 20:16 Vincent Stehlé [this message]
2016-09-22  1:32 ` zhangfei
2016-09-30 18:01 ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160921201655.19674-1-vincent.stehle@laposte.net \
    --to=vincent.stehle@laposte.net \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vinod.koul@intel.com \
    --cc=zhangfei.gao@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®