Add __copy_from_user checks to emu10k1

From: davej@codemonkey.org.uk
Date: Mon Mar 24 2003 - 11:42:01 EST


diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/emu10k1/cardwo.c linux-2.5/sound/oss/emu10k1/cardwo.c
--- bk-linus/sound/oss/emu10k1/cardwo.c 2003-03-22 12:36:23.000000000 +0000
+++ linux-2.5/sound/oss/emu10k1/cardwo.c 2003-03-22 12:41:48.000000000 +0000
@@ -408,14 +408,17 @@ static void copy_block(void **dst, u32 s
 
         if (len > PAGE_SIZE - pgoff) {
                 k = PAGE_SIZE - pgoff;
- __copy_from_user((u8 *)dst[pg] + pgoff, src, k);
+ if (__copy_from_user((u8 *)dst[pg] + pgoff, src, k))
+ return;
                 len -= k;
                 while (len > PAGE_SIZE) {
- __copy_from_user(dst[++pg], src + k, PAGE_SIZE);
+ if (__copy_from_user(dst[++pg], src + k, PAGE_SIZE))
+ return;
                         k += PAGE_SIZE;
                         len -= PAGE_SIZE;
                 }
- __copy_from_user(dst[++pg], src + k, len);
+ if (__copy_from_user(dst[++pg], src + k, len))
+ return;
 
         } else
                 __copy_from_user((u8 *)dst[pg] + pgoff, src, len);
@@ -440,7 +443,8 @@ static void copy_ilv_block(struct woinst
 
         while (len) {
                 for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) {
- __copy_from_user((u8 *)(voice[voice_num].mem.addr[pg]) + pgoff, src, woinst->format.bytespervoicesample);
+ if (__copy_from_user((u8 *)(voice[voice_num].mem.addr[pg]) + pgoff, src, woinst->format.bytespervoicesample))
+ return -EFAULT;
                         src += woinst->format.bytespervoicesample;
                 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:16 EST