aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/bfin_dma_5xx.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier.adi@gmail.com>2009-01-07 10:14:38 -0500
committerBryan Wu <cooloney@kernel.org>2009-01-07 10:14:38 -0500
commit49946e7329fa38d79aed1a9ef4a64c320ada305d (patch)
treefca7b02d8729fd3d16dbb01f83f4976353ec1f6b /arch/blackfin/kernel/bfin_dma_5xx.c
parentc9e0020d49587b1b214d65256a88a2978329aefe (diff)
Blackfin arch: check pointers in safe_dma_memcpy
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>
Diffstat (limited to 'arch/blackfin/kernel/bfin_dma_5xx.c')
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index 36f78c1648b9..bafb6aea0bc5 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -596,11 +596,18 @@ void *dma_memcpy(void *dest, const void *src, size_t size)
596} 596}
597EXPORT_SYMBOL(dma_memcpy); 597EXPORT_SYMBOL(dma_memcpy);
598 598
599/**
600 * safe_dma_memcpy - DMA memcpy w/argument checking
601 *
602 * Verify arguments are safe before heading to dma_memcpy().
603 */
599void *safe_dma_memcpy(void *dest, const void *src, size_t size) 604void *safe_dma_memcpy(void *dest, const void *src, size_t size)
600{ 605{
601 void *addr; 606 if (!access_ok(VERIFY_WRITE, dst, size))
602 addr = dma_memcpy(dest, src, size); 607 return NULL;
603 return addr; 608 if (!access_ok(VERIFY_READ, src, size))
609 return NULL;
610 return dma_memcpy(dst, src, size);
604} 611}
605EXPORT_SYMBOL(safe_dma_memcpy); 612EXPORT_SYMBOL(safe_dma_memcpy);
606 613