diff -urN 2.3.99-pre6-pre3/arch/mips/baget/vacserial.c 2.3.99-pre6-pre3-read-proc/arch/mips/baget/vacserial.c --- 2.3.99-pre6-pre3/arch/mips/baget/vacserial.c Sun Feb 27 06:19:41 2000 +++ 2.3.99-pre6-pre3-read-proc/arch/mips/baget/vacserial.c Fri Apr 21 19:17:19 2000 @@ -2168,7 +2168,7 @@ done: if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } diff -urN 2.3.99-pre6-pre3/arch/ppc/8xx_io/uart.c 2.3.99-pre6-pre3-read-proc/arch/ppc/8xx_io/uart.c --- 2.3.99-pre6-pre3/arch/ppc/8xx_io/uart.c Tue Apr 18 16:11:38 2000 +++ 2.3.99-pre6-pre3-read-proc/arch/ppc/8xx_io/uart.c Fri Apr 21 19:17:19 2000 @@ -2063,7 +2063,7 @@ done: if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } diff -urN 2.3.99-pre6-pre3/drivers/char/amiserial.c 2.3.99-pre6-pre3-read-proc/drivers/char/amiserial.c --- 2.3.99-pre6-pre3/drivers/char/amiserial.c Mon Apr 3 03:21:56 2000 +++ 2.3.99-pre6-pre3-read-proc/drivers/char/amiserial.c Fri Apr 21 19:17:19 2000 @@ -2066,7 +2066,7 @@ done: if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } diff -urN 2.3.99-pre6-pre3/drivers/char/ip2main.c 2.3.99-pre6-pre3-read-proc/drivers/char/ip2main.c --- 2.3.99-pre6-pre3/drivers/char/ip2main.c Fri Feb 11 00:05:33 2000 +++ 2.3.99-pre6-pre3-read-proc/drivers/char/ip2main.c Fri Apr 21 19:17:19 2000 @@ -3150,7 +3150,7 @@ if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } diff -urN 2.3.99-pre6-pre3/drivers/char/nvram.c 2.3.99-pre6-pre3-read-proc/drivers/char/nvram.c --- 2.3.99-pre6-pre3/drivers/char/nvram.c Tue Feb 15 03:06:47 2000 +++ 2.3.99-pre6-pre3-read-proc/drivers/char/nvram.c Fri Apr 21 19:17:19 2000 @@ -372,7 +372,7 @@ if (offset >= begin + len) return( 0 ); - *start = buffer + (begin - offset); + *start = buffer + (offset - begin); return( size < begin + len - offset ? size : begin + len - offset ); } diff -urN 2.3.99-pre6-pre3/drivers/char/serial.c 2.3.99-pre6-pre3-read-proc/drivers/char/serial.c --- 2.3.99-pre6-pre3/drivers/char/serial.c Tue Apr 18 16:12:15 2000 +++ 2.3.99-pre6-pre3-read-proc/drivers/char/serial.c Fri Apr 21 19:21:44 2000 @@ -3137,30 +3137,32 @@ return ret; } -int rs_read_proc(char *page, char **start, off_t off, int count, +int rs_read_proc(char *page, char **start, off_t idx, ssize_t count, int *eof, void *data) { - int i, len = 0, l; - off_t begin = 0; + int n; - len += sprintf(page, "serinfo:1.0 driver:%s%s revision:%s\n", - serial_version, LOCAL_VERSTRING, serial_revdate); - for (i = 0; i < NR_PORTS && len < 4000; i++) { - l = line_info(page + len, &rs_table[i]); - len += l; - if (len+begin > off+count) - goto done; - if (len+begin < off) { - begin += len; - len = 0; - } + *start = (char *) 1L; + + if (!idx) { + n = sprintf(page, "serinfo:1.0 driver:%s%s revision:%s\n", + serial_version, LOCAL_VERSTRING, serial_revdate); + goto out; } - *eof = 1; -done: - if (off >= len+begin) - return 0; - *start = page + (begin-off); - return ((count < begin+len-off) ? count : begin+len-off); + idx--; + + n = 0; + if (idx >= NR_PORTS || idx < 0) + goto out; + + n = line_info(page, &rs_table[idx]); + if (idx + 1 == NR_PORTS) + *eof = 1; + + out: + if (n > count) + n = 0; + return n; } /* diff -urN 2.3.99-pre6-pre3/drivers/char/synclink.c 2.3.99-pre6-pre3-read-proc/drivers/char/synclink.c --- 2.3.99-pre6-pre3/drivers/char/synclink.c Fri Dec 31 16:33:02 1999 +++ 2.3.99-pre6-pre3-read-proc/drivers/char/synclink.c Fri Apr 21 19:17:19 2000 @@ -3901,7 +3901,7 @@ done: if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } /* end of mgsl_read_proc() */ diff -urN 2.3.99-pre6-pre3/drivers/isdn/avmb1/capi.c 2.3.99-pre6-pre3-read-proc/drivers/isdn/avmb1/capi.c --- 2.3.99-pre6-pre3/drivers/isdn/avmb1/capi.c Tue Apr 18 16:12:17 2000 +++ 2.3.99-pre6-pre3-read-proc/drivers/isdn/avmb1/capi.c Fri Apr 21 19:17:19 2000 @@ -1840,7 +1840,7 @@ *eof = 1; if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } diff -urN 2.3.99-pre6-pre3/drivers/isdn/avmb1/kcapi.c 2.3.99-pre6-pre3-read-proc/drivers/isdn/avmb1/kcapi.c --- 2.3.99-pre6-pre3/drivers/isdn/avmb1/kcapi.c Tue Apr 18 16:12:17 2000 +++ 2.3.99-pre6-pre3-read-proc/drivers/isdn/avmb1/kcapi.c Fri Apr 21 19:19:06 2000 @@ -281,7 +281,7 @@ *eof = 1; if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } @@ -320,7 +320,7 @@ *eof = 1; if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } diff -urN 2.3.99-pre6-pre3/drivers/sbus/char/sab82532.c 2.3.99-pre6-pre3-read-proc/drivers/sbus/char/sab82532.c --- 2.3.99-pre6-pre3/drivers/sbus/char/sab82532.c Tue Apr 18 16:12:18 2000 +++ 2.3.99-pre6-pre3-read-proc/drivers/sbus/char/sab82532.c Fri Apr 21 19:17:19 2000 @@ -2100,7 +2100,7 @@ done: if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } diff -urN 2.3.99-pre6-pre3/drivers/sbus/char/su.c 2.3.99-pre6-pre3-read-proc/drivers/sbus/char/su.c --- 2.3.99-pre6-pre3/drivers/sbus/char/su.c Wed Mar 15 16:45:12 2000 +++ 2.3.99-pre6-pre3-read-proc/drivers/sbus/char/su.c Fri Apr 21 19:17:19 2000 @@ -2204,7 +2204,7 @@ done: if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } diff -urN 2.3.99-pre6-pre3/drivers/scsi/sg.c 2.3.99-pre6-pre3-read-proc/drivers/scsi/sg.c --- 2.3.99-pre6-pre3/drivers/scsi/sg.c Tue Apr 18 16:11:40 2000 +++ 2.3.99-pre6-pre3-read-proc/drivers/scsi/sg.c Fri Apr 21 19:37:35 2000 @@ -2429,8 +2429,7 @@ *eof = infofp(buffer, &len, &begin, offset, size); \ if (offset >= (begin + len)) \ return 0; \ - *start = buffer + ((begin > offset) ? \ - (begin - offset) : (offset - begin)); \ + *start = buffer + offset - begin; \ return (size < (begin + len - offset)) ? \ size : begin + len - offset; \ } while(0) diff -urN 2.3.99-pre6-pre3/fs/proc/generic.c 2.3.99-pre6-pre3-read-proc/fs/proc/generic.c --- 2.3.99-pre6-pre3/fs/proc/generic.c Tue Apr 18 16:11:41 2000 +++ 2.3.99-pre6-pre3-read-proc/fs/proc/generic.c Fri Apr 21 19:33:36 2000 @@ -140,9 +140,13 @@ { switch (orig) { case 0: + if (offset < 0) + return -EINVAL; file->f_pos = offset; return(file->f_pos); case 1: + if (offset + file->f_pos < 0) + return -EINVAL; file->f_pos += offset; return(file->f_pos); case 2: diff -urN 2.3.99-pre6-pre3/fs/proc/proc_tty.c 2.3.99-pre6-pre3-read-proc/fs/proc/proc_tty.c --- 2.3.99-pre6-pre3/fs/proc/proc_tty.c Wed Dec 8 00:05:27 1999 +++ 2.3.99-pre6-pre3-read-proc/fs/proc/proc_tty.c Fri Apr 21 19:17:19 2000 @@ -93,7 +93,7 @@ *eof = 1; if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } @@ -123,7 +123,7 @@ *eof = 1; if (off >= len+begin) return 0; - *start = page + (begin-off); + *start = page + (off-begin); return ((count < begin+len-off) ? count : begin+len-off); } diff -urN 2.3.99-pre6-pre3/net/irda/ircomm/ircomm_tty.c 2.3.99-pre6-pre3-read-proc/net/irda/ircomm/ircomm_tty.c --- 2.3.99-pre6-pre3/net/irda/ircomm/ircomm_tty.c Sun Feb 27 06:19:45 2000 +++ 2.3.99-pre6-pre3-read-proc/net/irda/ircomm/ircomm_tty.c Fri Apr 21 19:17:19 2000 @@ -1346,7 +1346,7 @@ done: if (offset >= count+begin) return 0; - *start = buf + (begin-offset); + *start = buf + (offset-begin); return ((len < begin+count-offset) ? len : begin+count-offset); }