Skip to content

Commit

Permalink
Blackfin arch: check pointers in safe_dma_memcpy
Browse files Browse the repository at this point in the history
Check pointers in safe_dma_memcpy as this is the entry point for user-space code

Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
  • Loading branch information
Mike Frysinger authored and Bryan Wu committed Jan 7, 2009
1 parent c9e0020 commit 49946e7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions arch/blackfin/kernel/bfin_dma_5xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,11 +596,18 @@ void *dma_memcpy(void *dest, const void *src, size_t size)
}
EXPORT_SYMBOL(dma_memcpy);

/**
* safe_dma_memcpy - DMA memcpy w/argument checking
*
* Verify arguments are safe before heading to dma_memcpy().
*/
void *safe_dma_memcpy(void *dest, const void *src, size_t size)
{
void *addr;
addr = dma_memcpy(dest, src, size);
return addr;
if (!access_ok(VERIFY_WRITE, dst, size))
return NULL;
if (!access_ok(VERIFY_READ, src, size))
return NULL;
return dma_memcpy(dst, src, size);
}
EXPORT_SYMBOL(safe_dma_memcpy);

Expand Down

0 comments on commit 49946e7

Please sign in to comment.