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>
#include "hw.h"
#include "dma.h"
#include "hw.h"
#include "dma.h"
/* provide a lookup table for setting the source address in the base or
* extended descriptor of an xor or pq descriptor
*/
/* provide a lookup table for setting the source address in the base or
* extended descriptor of an xor or pq descriptor
*/
ioat_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src,
unsigned int src_cnt, size_t len, unsigned long flags)
{
ioat_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src,
unsigned int src_cnt, size_t len, unsigned long flags)
{
- unsigned char scf[src_cnt];
+ unsigned char scf[MAX_SCF];
+ if (src_cnt > MAX_SCF)
+ return NULL;
+
memset(scf, 0, src_cnt);
pq[0] = dst;
flags |= DMA_PREP_PQ_DISABLE_Q;
memset(scf, 0, src_cnt);
pq[0] = dst;
flags |= DMA_PREP_PQ_DISABLE_Q;
unsigned int src_cnt, size_t len,
enum sum_check_flags *result, unsigned long flags)
{
unsigned int src_cnt, size_t len,
enum sum_check_flags *result, unsigned long flags)
{
- unsigned char scf[src_cnt];
+ unsigned char scf[MAX_SCF];
+ if (src_cnt > MAX_SCF)
+ return NULL;
+
/* the cleanup routine only sets bits on validate failure, it
* does not clear bits on validate success... so clear it here
*/
/* the cleanup routine only sets bits on validate failure, it
* does not clear bits on validate success... so clear it here
*/