[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-m68k
Subject:    Re: [PATCH] (1/22) lvalues abuse in dmasound
From:       Roman Zippel <zippel () linux-m68k ! org>
Date:       2005-08-25 9:04:29
Message-ID: Pine.LNX.4.61.0508251103160.24552 () scrub ! home
[Download RAW message or body]

Hi,

On Thu, 25 Aug 2005, Al Viro wrote:

> diff -urN RC13-rc7/sound/oss/dmasound/dmasound_paula.c \
>                 RC13-rc7-dmasound-lvalues/sound/oss/dmasound/dmasound_paula.c
> --- RC13-rc7/sound/oss/dmasound/dmasound_paula.c	2005-06-17 15:48:29.000000000 \
>                 -0400
> +++ RC13-rc7-dmasound-lvalues/sound/oss/dmasound/dmasound_paula.c	2005-08-25 \
> 00:54:04.000000000 -0400 @@ -253,8 +253,9 @@
> 		count = min_t(size_t, userCount, frameLeft)>>1 & ~1;	\
> 		used = count*2;						\
> 		while (count > 0) {					\
> -			if (get_user(data, ((u_short *)userPtr)++))	\
> +			if (get_user(data, (u_short *)userPtr))		\
> 				return -EFAULT;				\
> +			userPtr += 2;					\
> 			data = convsample(data);			\
> 			*high++ = data>>8;				\
> 			*low++ = (data>>2) & 0x3f;			\
> @@ -268,13 +269,15 @@
> 		count = min_t(size_t, userCount, frameLeft)>>2 & ~1;	\
> 		used = count*4;						\
> 		while (count > 0) {					\
> -			if (get_user(data, ((u_short *)userPtr)++))	\
> +			if (get_user(data, (u_short *)userPtr))		\
> 				return -EFAULT;				\
> +			userPtr += 2;					\
> 			data = convsample(data);			\
> 			*lefth++ = data>>8;				\
> 			*leftl++ = (data>>2) & 0x3f;			\
> -			if (get_user(data, ((u_short *)userPtr)++))	\
> +			if (get_user(data, (u_short *)userPtr))		\
> 				return -EFAULT;				\
> +			userPtr += 2;					\
> 			data = convsample(data);			\
> 			*righth++ = data>>8;				\
> 			*rightl++ = (data>>2) & 0x3f;			\

Please replace this with the patch from CVS:

Index: sound/oss/dmasound/dmasound_paula.c
===================================================================
RCS file: /home/linux-m68k/cvsroot/linux/sound/oss/dmasound/dmasound_paula.c,v
retrieving revision 1.1.1.7
retrieving revision 1.6
diff -u -p -r1.1.1.7 -r1.6
--- sound/oss/dmasound/dmasound_paula.c	15 Aug 2004 14:21:28 -0000	1.1.1.7
+++ sound/oss/dmasound/dmasound_paula.c	29 May 2005 18:01:55 -0000	1.6
@@ -244,6 +244,7 @@ static ssize_t funcname(const u_char *us
 			u_char frame[], ssize_t *frameUsed,		\
 			ssize_t frameLeft)				\
 {									\
+	const u_short *ptr = (const u_short *)userPtr;			\
 	ssize_t count, used;						\
 	u_short data;							\
 									\
@@ -253,7 +254,7 @@ static ssize_t funcname(const u_char *us
 		count = min_t(size_t, userCount, frameLeft)>>1 & ~1;	\
 		used = count*2;						\
 		while (count > 0) {					\
-			if (get_user(data, ((u_short *)userPtr)++))	\
+			if (get_user(data, ptr++))			\
 				return -EFAULT;				\
 			data = convsample(data);			\
 			*high++ = data>>8;				\
@@ -268,12 +269,12 @@ static ssize_t funcname(const u_char *us
 		count = min_t(size_t, userCount, frameLeft)>>2 & ~1;	\
 		used = count*4;						\
 		while (count > 0) {					\
-			if (get_user(data, ((u_short *)userPtr)++))	\
+			if (get_user(data, ptr++))			\
 				return -EFAULT;				\
 			data = convsample(data);			\
 			*lefth++ = data>>8;				\
 			*leftl++ = (data>>2) & 0x3f;			\
-			if (get_user(data, ((u_short *)userPtr)++))	\
+			if (get_user(data, ptr++))			\
 				return -EFAULT;				\
 			data = convsample(data);			\
 			*righth++ = data>>8;				\


bye, Roman
-
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic