patch-2.4.27 linux-2.4.27/arch/ppc64/kernel/rtas-proc.c
Next file: linux-2.4.27/arch/s390/kernel/debug.c
Previous file: linux-2.4.27/arch/ppc64/kernel/proc_pmc.c
Back to the patch index
Back to the overall index
- Lines: 182
- Date:
2004-08-07 16:26:04.596344394 -0700
- Orig file:
linux-2.4.26/arch/ppc64/kernel/rtas-proc.c
- Orig date:
2004-02-18 05:36:30.000000000 -0800
diff -urN linux-2.4.26/arch/ppc64/kernel/rtas-proc.c linux-2.4.27/arch/ppc64/kernel/rtas-proc.c
@@ -337,6 +337,7 @@
{
char stkbuf[40]; /* its small, its on stack */
int n;
+ loff_t pos = *ppos;
if (power_on_time == 0)
n = snprintf(stkbuf, 40, "Power on time not set\n");
@@ -344,15 +345,15 @@
n = snprintf(stkbuf, 40, "%lu\n", power_on_time);
int sn = strlen(stkbuf) +1;
- if (*ppos >= sn)
+ if (pos != (unsigned)pos || pos >= sn)
return 0;
- if (n > sn - *ppos)
- n = sn - *ppos;
+ if (n > sn - pos)
+ n = sn - pos;
if (n > count)
n = count;
- if (copy_to_user(buf, stkbuf + (*ppos), n))
+ if (copy_to_user(buf, stkbuf + pos, n))
return -EFAULT;
- *ppos += n;
+ *ppos = pos + n;
return n;
}
@@ -384,6 +385,7 @@
size_t count, loff_t *ppos)
{
int n = 0, sn;
+ loff_t pos = *ppos;
if (progress_led == NULL)
return 0;
@@ -396,20 +398,20 @@
n = sprintf (tmpbuf, "%s\n", progress_led);
sn = strlen (tmpbuf) +1;
- if (*ppos >= sn) {
+ if (pos != (unsigned)pos || pos >= sn) {
kfree(tmpbuf);
return 0;
}
- if (n > sn - *ppos)
- n = sn - *ppos;
+ if (n > sn - pos)
+ n = sn - pos;
if (n > count)
n = count;
- if (copy_to_user(buf, tmpbuf + (*ppos), n)) {
+ if (copy_to_user(buf, tmpbuf + pos), n) {
kfree(tmpbuf);
return -EFAULT;
}
kfree(tmpbuf);
- *ppos += n;
+ *ppos = pos + n;
return n;
}
@@ -453,6 +455,7 @@
unsigned int year, mon, day, hour, min, sec;
unsigned long *ret = kmalloc(4*8, GFP_KERNEL);
int n, error;
+ loff_t pos = *ppos;
error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
@@ -471,16 +474,16 @@
kfree(ret);
int sn = strlen(stkbuf) +1;
- if (*ppos >= sn)
+ if (pos != (unsigned)pos || pos >= sn)
return 0;
- if (n > sn - *ppos)
- n = sn - *ppos;
+ if (n > sn - pos)
+ n = sn - pos;
if (n > count)
n = count;
- if (copy_to_user(buf, stkbuf + (*ppos), n))
+ if (copy_to_user(buf, stkbuf + pos, n))
return -EFAULT;
- *ppos += n;
+ *ppos = pos + n;
return n;
}
@@ -878,20 +881,21 @@
{
int n, sn;
char stkbuf[40]; /* its small, its on stack */
+ loff_t pos = *ppos;
n = snprintf(stkbuf, 40, "%lu\n", rtas_tone_frequency);
sn = strlen(stkbuf) +1;
- if (*ppos >= sn)
+ if (pos != (unsigned)pos || pos >= sn)
return 0;
- if (n > sn - *ppos)
- n = sn - *ppos;
+ if (n > sn - pos)
+ n = sn - pos;
if (n > count)
n = count;
- if (copy_to_user(buf, stkbuf + (*ppos), n))
+ if (copy_to_user(buf, stkbuf + pos, n))
return -EFAULT;
- *ppos += n;
+ *ppos = pos + n;
return n;
}
/* ****************************************************************** */
@@ -933,19 +937,20 @@
{
int n, sn;
char stkbuf[40]; /* its small, its on stack */
+ loff_t pos = *ppos;
n = snprintf(stkbuf, 40, "%lu\n", rtas_tone_volume);
sn = strlen(stkbuf) +1;
- if (*ppos >= sn)
+ if (pos != (unsigned)pos || pos >= sn)
return 0;
- if (n > sn - *ppos)
- n = sn - *ppos;
+ if (n > sn - pos)
+ n = sn - pos;
if (n > count)
n = count;
- if (copy_to_user(buf, stkbuf + (*ppos), n))
+ if (copy_to_user(buf, stkbuf + pos, n))
return -EFAULT;
- *ppos += n;
+ *ppos = pos + n;
return n;
}
@@ -1064,6 +1069,7 @@
char * buffer;
int i, sn;
int n = 0;
+ loff_t pos = *ppos;
int m = MAX_ERRINJCT_TOKENS * (ERRINJCT_TOKEN_LEN+1);
buffer = (char *)kmalloc(m, GFP_KERNEL);
@@ -1078,22 +1084,22 @@
}
sn = strlen(buffer) +1;
- if (*ppos >= sn) {
+ if (pos != (unsigned)pos || pos >= sn) {
kfree(buffer);
return 0;
}
- if (n > sn - *ppos)
- n = sn - *ppos;
+ if (n > sn - pos)
+ n = sn - pos;
if (n > count)
n = count;
- if (copy_to_user(buf, buffer + *ppos, n)) {
+ if (copy_to_user(buf, buffer + pos, n)) {
kfree(buffer);
return -EFAULT;
}
- *ppos += n;
+ *ppos = pos + n;
kfree(buffer);
return n;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)