diff -urN 2.2.15pre19/arch/mips/baget/vacserial.c 2.2.15pre19-readproc/arch/mips/baget/vacserial.c --- 2.2.15pre19/arch/mips/baget/vacserial.c Mon Jan 17 16:44:34 2000 +++ 2.2.15pre19-readproc/arch/mips/baget/vacserial.c Fri Apr 21 17:34:41 2000 @@ -2162,7 +2162,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.2.15pre19/arch/ppc/8xx_io/uart.c 2.2.15pre19-readproc/arch/ppc/8xx_io/uart.c --- 2.2.15pre19/arch/ppc/8xx_io/uart.c Mon Jan 17 16:44:35 2000 +++ 2.2.15pre19-readproc/arch/ppc/8xx_io/uart.c Fri Apr 21 17:34:41 2000 @@ -2050,7 +2050,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.2.15pre19/drivers/char/ip2main.c 2.2.15pre19-readproc/drivers/char/ip2main.c --- 2.2.15pre19/drivers/char/ip2main.c Fri Apr 21 15:59:21 2000 +++ 2.2.15pre19-readproc/drivers/char/ip2main.c Fri Apr 21 17:34:33 2000 @@ -3175,7 +3175,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.2.15pre19/drivers/char/nvram.c 2.2.15pre19-readproc/drivers/char/nvram.c --- 2.2.15pre19/drivers/char/nvram.c Mon Jan 17 16:44:37 2000 +++ 2.2.15pre19-readproc/drivers/char/nvram.c Fri Apr 21 17:34:33 2000 @@ -373,7 +373,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.2.15pre19/drivers/char/serial.c 2.2.15pre19-readproc/drivers/char/serial.c --- 2.2.15pre19/drivers/char/serial.c Fri Apr 21 15:59:21 2000 +++ 2.2.15pre19-readproc/drivers/char/serial.c Fri Apr 21 17:35:28 2000 @@ -2782,29 +2782,31 @@ 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\n", serial_version); - for (i = 0; i < NR_PORTS && len < 3900; 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\n", serial_version); + 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.2.15pre19/drivers/char/synclink.c 2.2.15pre19-readproc/drivers/char/synclink.c --- 2.2.15pre19/drivers/char/synclink.c Fri Apr 21 15:59:21 2000 +++ 2.2.15pre19-readproc/drivers/char/synclink.c Fri Apr 21 17:34:33 2000 @@ -3902,7 +3902,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.2.15pre19/drivers/isdn/avmb1/capi.c 2.2.15pre19-readproc/drivers/isdn/avmb1/capi.c --- 2.2.15pre19/drivers/isdn/avmb1/capi.c Fri Apr 21 15:59:21 2000 +++ 2.2.15pre19-readproc/drivers/isdn/avmb1/capi.c Fri Apr 21 17:34:41 2000 @@ -564,7 +564,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.2.15pre19/drivers/isdn/avmb1/kcapi.c 2.2.15pre19-readproc/drivers/isdn/avmb1/kcapi.c --- 2.2.15pre19/drivers/isdn/avmb1/kcapi.c Fri Apr 21 15:59:21 2000 +++ 2.2.15pre19-readproc/drivers/isdn/avmb1/kcapi.c Fri Apr 21 17:45:12 2000 @@ -250,7 +250,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); } @@ -289,7 +289,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.2.15pre19/drivers/sbus/char/sab82532.c 2.2.15pre19-readproc/drivers/sbus/char/sab82532.c --- 2.2.15pre19/drivers/sbus/char/sab82532.c Fri Apr 21 15:59:22 2000 +++ 2.2.15pre19-readproc/drivers/sbus/char/sab82532.c Fri Apr 21 17:34:41 2000 @@ -2065,7 +2065,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.2.15pre19/drivers/sbus/char/su.c 2.2.15pre19-readproc/drivers/sbus/char/su.c --- 2.2.15pre19/drivers/sbus/char/su.c Fri Apr 21 15:59:22 2000 +++ 2.2.15pre19-readproc/drivers/sbus/char/su.c Fri Apr 21 17:34:41 2000 @@ -2207,7 +2207,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.2.15pre19/fs/proc/generic.c 2.2.15pre19-readproc/fs/proc/generic.c --- 2.2.15pre19/fs/proc/generic.c Mon Jan 17 16:44:43 2000 +++ 2.2.15pre19-readproc/fs/proc/generic.c Fri Apr 21 19:31:39 2000 @@ -198,9 +198,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.2.15pre19/fs/proc/proc_tty.c 2.2.15pre19-readproc/fs/proc/proc_tty.c --- 2.2.15pre19/fs/proc/proc_tty.c Mon Jan 17 16:44:43 2000 +++ 2.2.15pre19-readproc/fs/proc/proc_tty.c Fri Apr 21 17:34:33 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.2.15pre19/net/irda/ircomm/ircomm_tty.c 2.2.15pre19-readproc/net/irda/ircomm/ircomm_tty.c --- 2.2.15pre19/net/irda/ircomm/ircomm_tty.c Fri Apr 21 15:59:25 2000 +++ 2.2.15pre19-readproc/net/irda/ircomm/ircomm_tty.c Fri Apr 21 17:34:33 2000 @@ -1347,7 +1347,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); }