Commit fd2d09bc authored by Federico Vaga's avatar Federico Vaga

sw:drv: do not run DMA with 'count = 0'

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent c38f3bf5
......@@ -260,6 +260,9 @@ static ssize_t spec_fpga_dbg_dma_read(struct file *file, char __user *buf,
int err;
void *data;
if (count == 0)
return 0;
count = min(KMALLOC_MAX_SIZE, count);
data = kmalloc(count, GFP_KERNEL);
if (!data)
......@@ -290,6 +293,9 @@ static ssize_t spec_fpga_dbg_dma_write(struct file *file,
int err;
void *data;
if (count == 0)
return 0;
count = max(KMALLOC_MAX_SIZE, count);
data = kmalloc(count, GFP_KERNEL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment