[PATCH 2.4.26] kernel/sysctl.c fix compiler warnings

From: Thomas Gleixner
Date: Sat May 15 2004 - 06:40:02 EST


Hi,

The patch fixes the following warnings, produced by gcc3.3.3:

sysctl.c: In function `do_proc_dointvec':
sysctl.c:879: warning: use of cast expressions as lvalues is deprecated
sysctl.c: In function `proc_dointvec_minmax':
sysctl.c:1032: warning: use of cast expressions as lvalues is deprecated
sysctl.c: In function `do_proc_doulongvec_minmax':
sysctl.c:1133: warning: use of cast expressions as lvalues is deprecated

--
Thomas
________________________________________________________________________
"Free software" is a matter of liberty, not price. To understand the concept,
you should think of "free" as in "free speech,'' not as in "free beer".
My 0.02$: Keep in mind that "free beer" can have a price too: "an hangover".
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx@xxxxxxxxxxxxx

--- linux-2.4.26.org/kernel/sysctl.c 2003-11-28 19:26:21.000000000 +0100
+++ linux-2.4.26/kernel/sysctl.c 2004-05-15 13:12:54.000000000 +0200
@@ -854,6 +854,7 @@
int *i, vleft, first=1, neg, val;
size_t left, len;

+ char *pbuffer = (char *) buffer;
#define TMPBUFLEN 20
char buf[TMPBUFLEN], *p;

@@ -871,12 +872,12 @@
if (write) {
while (left) {
char c;
- if (get_user(c, (char *) buffer))
+ if (get_user(c, pbuffer))
return -EFAULT;
if (!isspace(c))
break;
left--;
- ((char *) buffer)++;
+ pbuffer++;
}
if (!left)
break;
@@ -884,7 +885,7 @@
len = left;
if (len > TMPBUFLEN-1)
len = TMPBUFLEN-1;
- if(copy_from_user(buf, buffer, len))
+ if(copy_from_user(buf, pbuffer, len))
return -EFAULT;
buf[len] = 0;
p = buf;
@@ -900,7 +901,7 @@
break;
if (neg)
val = -val;
- buffer += len;
+ pbuffer += len;
left -= len;
switch(op) {
case OP_SET: *i = val; break;
@@ -921,23 +922,22 @@
len = strlen(buf);
if (len > left)
len = left;
- if(copy_to_user(buffer, buf, len))
+ if(copy_to_user(pbuffer, buf, len))
return -EFAULT;
left -= len;
- buffer += len;
+ pbuffer += len;
}
}

if (!write && !first && left) {
- if(put_user('\n', (char *) buffer))
+ if(put_user('\n', pbuffer))
return -EFAULT;
- left--, buffer++;
+ left--, pbuffer++;
}
if (write) {
- p = (char *) buffer;
while (left) {
char c;
- if (get_user(c, p++))
+ if (get_user(c, pbuffer++))
return -EFAULT;
if (!isspace(c))
break;
@@ -1007,6 +1007,7 @@
size_t len, left;
#define TMPBUFLEN 20
char buf[TMPBUFLEN], *p;
+ char *pbuffer = (char *) buffer;

if (!table->data || !table->maxlen || !*lenp ||
(filp->f_pos && !write)) {
@@ -1024,12 +1025,12 @@
if (write) {
while (left) {
char c;
- if (get_user(c, (char *) buffer))
+ if (get_user(c, pbuffer))
return -EFAULT;
if (!isspace(c))
break;
left--;
- ((char *) buffer)++;
+ pbuffer++;
}
if (!left)
break;
@@ -1037,7 +1038,7 @@
len = left;
if (len > TMPBUFLEN-1)
len = TMPBUFLEN-1;
- if(copy_from_user(buf, buffer, len))
+ if(copy_from_user(buf, pbuffer, len))
return -EFAULT;
buf[len] = 0;
p = buf;
@@ -1053,7 +1054,7 @@
break;
if (neg)
val = -val;
- buffer += len;
+ pbuffer += len;
left -= len;

if ((min && val < *min) || (max && val > *max))
@@ -1067,23 +1068,22 @@
len = strlen(buf);
if (len > left)
len = left;
- if(copy_to_user(buffer, buf, len))
+ if(copy_to_user(pbuffer, buf, len))
return -EFAULT;
left -= len;
- buffer += len;
+ pbuffer += len;
}
}

if (!write && !first && left) {
- if(put_user('\n', (char *) buffer))
+ if(put_user('\n', (char *) pbuffer))
return -EFAULT;
- left--, buffer++;
+ left--, pbuffer++;
}
if (write) {
- p = (char *) buffer;
while (left) {
char c;
- if (get_user(c, p++))
+ if (get_user(c, pbuffer++))
return -EFAULT;
if (!isspace(c))
break;
@@ -1108,6 +1108,7 @@
int vleft, first=1, neg;
size_t len, left;
char buf[TMPBUFLEN], *p;
+ char *pbuffer = (char *) buffer;

if (!table->data || !table->maxlen || !*lenp ||
(filp->f_pos && !write)) {
@@ -1125,12 +1126,12 @@
if (write) {
while (left) {
char c;
- if (get_user(c, (char *) buffer))
+ if (get_user(c, pbuffer))
return -EFAULT;
if (!isspace(c))
break;
left--;
- ((char *) buffer)++;
+ pbuffer++;
}
if (!left)
break;
@@ -1138,7 +1139,7 @@
len = left;
if (len > TMPBUFLEN-1)
len = TMPBUFLEN-1;
- if(copy_from_user(buf, buffer, len))
+ if(copy_from_user(buf, pbuffer, len))
return -EFAULT;
buf[len] = 0;
p = buf;
@@ -1154,7 +1155,7 @@
break;
if (neg)
val = -val;
- buffer += len;
+ pbuffer += len;
left -= len;

if(neg)
@@ -1172,23 +1173,22 @@
len = strlen(buf);
if (len > left)
len = left;
- if(copy_to_user(buffer, buf, len))
+ if(copy_to_user(pbuffer, buf, len))
return -EFAULT;
left -= len;
- buffer += len;
+ pbuffer += len;
}
}

if (!write && !first && left) {
- if(put_user('\n', (char *) buffer))
+ if(put_user('\n', pbuffer))
return -EFAULT;
- left--, buffer++;
+ left--, pbuffer++;
}
if (write) {
- p = (char *) buffer;
while (left) {
char c;
- if (get_user(c, p++))
+ if (get_user(c, pbuffer++))
return -EFAULT;
if (!isspace(c))
break;

-
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/