diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2010-11-03 13:56:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-03 14:39:58 -0400 |
commit | ff8b16d7e15a8ba2a6086645614a483e048e3fbf (patch) | |
tree | bba0a06fe931072b5794960e8dd928769ca58ce9 /mm | |
parent | 81a6cff678ecee7cdc0658285d3150660c07cfce (diff) |
vmstat: fix offset calculation on void*
Fix regression introduced by commit 79da826aee6 ("writeback: report
dirty thresholds in /proc/vmstat").
The incorrect pointer arithmetic can result in problems like this:
BUG: unable to handle kernel paging request at 07c06d16
IP: [<c050c336>] strnlen+0x6/0x20
Call Trace:
[<c050a249>] ? string+0x39/0xe0
[<c042be6b>] ? __wake_up_common+0x4b/0x80
[<c050afcc>] ? vsnprintf+0x1ec/0x380
[<c04b380e>] ? seq_printf+0x2e/0x60
[<c04829a6>] ? vmstat_show+0x26/0x30
[<c04b3bb6>] ? seq_read+0xa6/0x380
[<c04b3b10>] ? seq_read+0x0/0x380
[<c04d5d2f>] ? proc_reg_read+0x5f/0x90
[<c049c4a1>] ? vfs_read+0xa1/0x140
[<c04d5cd0>] ? proc_reg_read+0x0/0x90
[<c049c981>] ? sys_read+0x41/0x70
[<c0402bd0>] ? sysenter_do_call+0x12/0x26
Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Michael Rubin <mrubin@google.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/vmstat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c index cd2e42be7b68..42eac4d33216 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -949,7 +949,7 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos) | |||
949 | v[PGPGIN] /= 2; /* sectors -> kbytes */ | 949 | v[PGPGIN] /= 2; /* sectors -> kbytes */ |
950 | v[PGPGOUT] /= 2; | 950 | v[PGPGOUT] /= 2; |
951 | #endif | 951 | #endif |
952 | return m->private + *pos; | 952 | return (unsigned long *)m->private + *pos; |
953 | } | 953 | } |
954 | 954 | ||
955 | static void *vmstat_next(struct seq_file *m, void *arg, loff_t *pos) | 955 | static void *vmstat_next(struct seq_file *m, void *arg, loff_t *pos) |