]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dma: cppi41: off by one in desc_to_chan()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 28 Aug 2013 10:48:44 +0000 (13:48 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Aug 2013 22:46:33 +0000 (15:46 -0700)
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>
drivers/dma/cppi41.c

index 6c4e64f2f3e76858f9148a79b5f1c69540a412b7..7c82b92f9b16f18bf1ce4e6bedb988f5d5b70e22 100644 (file)
@@ -242,7 +242,7 @@ static struct cppi41_channel *desc_to_chan(struct cppi41_dd *cdd, u32 desc)
        }
 
        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;