dma: cppi41: off by one in desc_to_chan()
The test here should be ">=" instead of ">". The cdd->chan_busy[] array
has "ALLOC_DECS_NUM" elements.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c
index 6c4e64f..7c82b92 100644
--- a/drivers/dma/cppi41.c
+++ b/drivers/dma/cppi41.c
@@ -242,7 +242,7 @@
}
desc_num = (desc - cdd->descs_phys) / sizeof(struct cppi41_desc);
- BUG_ON(desc_num > ALLOC_DECS_NUM);
+ BUG_ON(desc_num >= ALLOC_DECS_NUM);
c = cdd->chan_busy[desc_num];
cdd->chan_busy[desc_num] = NULL;
return c;