Merge tag 'dmaengine-fix-4.11-rc5' of git://git.infradead.org/users/vkoul/slave-dma

Pull dmaengine fixes from Vinod Koul:
 "A couple of minor fixes for 4.11:

   - array bound fix for __get_unmap_pool()

   - cyclic period splitting for bcm2835"

* tag 'dmaengine-fix-4.11-rc5' of git://git.infradead.org/users/vkoul/slave-dma:
  dmaengine: Fix array index out of bounds warning in __get_unmap_pool()
  dmaengine: bcm2835: Fix cyclic DMA period splitting
This commit is contained in:
Linus Torvalds
2017-04-02 16:29:34 -07:00
2 changed files with 6 additions and 1 deletions

View File

@@ -251,8 +251,11 @@ static void bcm2835_dma_create_cb_set_length(
*/ */
/* have we filled in period_length yet? */ /* have we filled in period_length yet? */
if (*total_len + control_block->length < period_len) if (*total_len + control_block->length < period_len) {
/* update number of bytes in this period so far */
*total_len += control_block->length;
return; return;
}
/* calculate the length that remains to reach period_length */ /* calculate the length that remains to reach period_length */
control_block->length = period_len - *total_len; control_block->length = period_len - *total_len;

View File

@@ -1108,12 +1108,14 @@ static struct dmaengine_unmap_pool *__get_unmap_pool(int nr)
switch (order) { switch (order) {
case 0 ... 1: case 0 ... 1:
return &unmap_pool[0]; return &unmap_pool[0];
#if IS_ENABLED(CONFIG_DMA_ENGINE_RAID)
case 2 ... 4: case 2 ... 4:
return &unmap_pool[1]; return &unmap_pool[1];
case 5 ... 7: case 5 ... 7:
return &unmap_pool[2]; return &unmap_pool[2];
case 8: case 8:
return &unmap_pool[3]; return &unmap_pool[3];
#endif
default: default:
BUG(); BUG();
return NULL; return NULL;