Re: [PATCH] (1/22) lvalues abuse in dmasound

From: Roman Zippel
Date: Thu Aug 25 2005 - 04:05:31 EST


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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/