aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2015-08-25 15:58:11 -0400
committerVinod Koul <vinod.koul@intel.com>2015-08-25 22:23:58 -0400
commit7b7d0ca7778d359584859cb5e75965ad34f42533 (patch)
tree6f4fdd86026e38af82fe190436d6001c911b1fc8
parent5c65cb93a3d066f52a109552572304675d5a52fc (diff)
dmaengine: ioatdma: Fix variable array length
Sparse reported: drivers/dma/ioat/prep.c:637:27: sparse: Variable length array is used. Assigning a static value for the array. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/ioat/prep.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/dma/ioat/prep.c b/drivers/dma/ioat/prep.c
index e323a4036908..ad4fb41cd23b 100644
--- a/drivers/dma/ioat/prep.c
+++ b/drivers/dma/ioat/prep.c
@@ -26,6 +26,8 @@
26#include "hw.h" 26#include "hw.h"
27#include "dma.h" 27#include "dma.h"
28 28
29#define MAX_SCF 1024
30
29/* provide a lookup table for setting the source address in the base or 31/* provide a lookup table for setting the source address in the base or
30 * extended descriptor of an xor or pq descriptor 32 * extended descriptor of an xor or pq descriptor
31 */ 33 */
@@ -634,9 +636,12 @@ struct dma_async_tx_descriptor *
634ioat_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src, 636ioat_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src,
635 unsigned int src_cnt, size_t len, unsigned long flags) 637 unsigned int src_cnt, size_t len, unsigned long flags)
636{ 638{
637 unsigned char scf[src_cnt]; 639 unsigned char scf[MAX_SCF];
638 dma_addr_t pq[2]; 640 dma_addr_t pq[2];
639 641
642 if (src_cnt > MAX_SCF)
643 return NULL;
644
640 memset(scf, 0, src_cnt); 645 memset(scf, 0, src_cnt);
641 pq[0] = dst; 646 pq[0] = dst;
642 flags |= DMA_PREP_PQ_DISABLE_Q; 647 flags |= DMA_PREP_PQ_DISABLE_Q;
@@ -654,9 +659,12 @@ ioat_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src,
654 unsigned int src_cnt, size_t len, 659 unsigned int src_cnt, size_t len,
655 enum sum_check_flags *result, unsigned long flags) 660 enum sum_check_flags *result, unsigned long flags)
656{ 661{
657 unsigned char scf[src_cnt]; 662 unsigned char scf[MAX_SCF];
658 dma_addr_t pq[2]; 663 dma_addr_t pq[2];
659 664
665 if (src_cnt > MAX_SCF)
666 return NULL;
667
660 /* the cleanup routine only sets bits on validate failure, it 668 /* the cleanup routine only sets bits on validate failure, it
661 * does not clear bits on validate success... so clear it here 669 * does not clear bits on validate success... so clear it here
662 */ 670 */