Skip to contentSkip to conversation

dmaengine: cppi41: Fix channel queues array size check

PATCH Applied Vasyl Gomonovych 2 participants 2 messages Dec 21, 2017 – Dec 22, 2017 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: cppi41: Fix channel queues array size check

The test should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().

---
 drivers/dma/cppi41.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/cppi41.c +1 -1
index f7e965f63274..d9bee65a18a4 100644
@@ -934,7 +934,7 @@ static bool cpp41_dma_filter_fn(struct dma_chan *chan, void *param)
 
 	BUILD_BUG_ON(ARRAY_SIZE(am335x_usb_queues_rx) !=
 		     ARRAY_SIZE(am335x_usb_queues_tx));
-	if (WARN_ON(cchan->port_num > ARRAY_SIZE(am335x_usb_queues_rx)))
+	if (WARN_ON(cchan->port_num >= ARRAY_SIZE(am335x_usb_queues_rx)))
 		return false;
 
 	cchan->q_num = queues[cchan->port_num].submit;
Applied
#1 lore raw
Quoted 1 line · Vasyl Gomonovych

The test should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().

Applied, thanks

Signature · 1 line
~Vinod