mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Add __copy_from_user checks to emu10k1
@ 2003-03-24 16:42 davej
  0 siblings, 0 replies; only message in thread
From: davej @ 2003-03-24 16:42 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

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;
 		}
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-24 16:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-24 16:42 Add __copy_from_user checks to emu10k1 davej

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®