On Sun, Apr 27, 2008 at 02:36:42AM -0400, Dan Noe wrote:[snip] [snip] I have a fix for the NULL pointer reference BUG, tested on my pc. --- "m" will be NULL if seq_printf & seq_puts is called from sched_debug_show Use SEQ_* macros to fix it Signed-off-by: Dave Young <hidave.darkstar@gmail.com> --- include/linux/sched.h | 22 ++++++++++++++++++++++ kernel/sched_debug.c | 12 ------------ kernel/sched_fair.c | 6 +++--- 3 files changed, 25 insertions(+), 15 deletions(-) diff -upr linux/include/linux/sched.h linux.new/include/linux/sched.h --- linux/include/linux/sched.h 2008-04-28 14:27:25.000000000 +0800 +++ linux.new/include/linux/sched.h 2008-04-28 14:37:45.000000000 +0800 @@ -2145,6 +2145,28 @@ static inline void migration_init(void) #define TASK_SIZE_OF(tsk) TASK_SIZE #endif +#ifdef CONFIG_SCHED_DEBUG +/* + * This allows printing both to /proc/sched_debug and + * to the console + */ +#define SEQ_printf(m, x...) \ + do { \ + if (m) \ + seq_printf(m, x); \ + else \ + printk(x); \ + } while (0) + +#define SEQ_puts(m, x...) \ + do { \ + if (m) \ + seq_puts(m, x); \ + else \ + printk(x); \ + } while (0) +#endif + #endif /* __KERNEL__ */ #endif diff -upr linux/kernel/sched_debug.c linux.new/kernel/sched_debug.c --- linux/kernel/sched_debug.c 2008-04-28 14:24:02.000000000 +0800 +++ linux.new/kernel/sched_debug.c 2008-04-28 14:37:32.000000000 +0800 @@ -17,18 +17,6 @@ #include <linux/utsname.h> /* - * This allows printing both to /proc/sched_debug and - * to the console - */ -#define SEQ_printf(m, x...) \ - do { \ - if (m) \ - seq_printf(m, x); \ - else \ - printk(x); \ - } while (0) - -/* * Ease the printing of nsec fields: */ static long long nsec_high(unsigned long long nsec) diff -upr linux/kernel/sched_fair.c linux.new/kernel/sched_fair.c --- linux/kernel/sched_fair.c 2008-04-28 14:16:17.000000000 +0800 +++ linux.new/kernel/sched_fair.c 2008-04-28 14:37:24.000000000 +0800 @@ -1623,9 +1623,9 @@ print_cfs_rq_tasks(struct seq_file *m, s int i; for (i = depth; i; i--) - seq_puts(m, " "); + SEQ_puts(m, " "); - seq_printf(m, "%lu %s %lu\n", + SEQ_printf(m, "%lu %s %lu\n", se->load.weight, entity_is_task(se) ? "T" : "G", calc_delta_weight(SCHED_LOAD_SCALE, se) @@ -1643,7 +1643,7 @@ static void print_cfs_stats(struct seq_f for_each_leaf_cfs_rq(cpu_rq(cpu), cfs_rq) print_cfs_rq(m, cpu, cfs_rq); - seq_printf(m, "\nWeight tree:\n"); + SEQ_printf(m, "\nWeight tree:\n"); print_cfs_rq_tasks(m, &cpu_rq(cpu)->cfs, 1); rcu_read_unlock(); } --
| Linus Torvalds | Linux 2.6.27 |
| Linus Torvalds | Linux 2.6.27-rc8 |
| Tejun Heo | [PATCHSET] FUSE: extend FUSE to support more operations |
| James Bottomley | Re: Integration of SCST in the mainstream Linux kernel |
git: | |
| Ken Pratt | pack operation is thrashing my server |
| Jakub Narebski | Re: VCS comparison table |
| H. Peter Anvin | Re: git versus CVS (versus bk) |
| Marco Costalba | [PATCH 11/11] Convert sha1_file.c to use decompress helpers |
| Richard Stallman | Real men don't attack straw men |
| Marcos Laufer | dmesg IBM x3650 OpenBSD 4.3 |
| Brian A. Seklecki | Re: GRE over IPsec |
| sonjaya | openvpn on openbsd 4.1 |
| Hugh Dickins | Re: [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Gilles Chanteperdrix | [PATCH] cs89x0: add support for i.MX31ADS ARM board |
| Denys Fedoryshchenko | thousands of classes, e1000 TX unit hang |
| Francois Romieu | Re: 8169 Intermittent ifup Failure Issue With RTL8102E Chipset in Intel's New D945... |
| Shared swap partition | 11 hours ago | Linux general |
| high memory | 2 days ago | Linux kernel |
| semaphore access speed | 2 days ago | Applications and Utilities |
| the kernel how to power off the machine | 2 days ago | Linux kernel |
| Easter Eggs in windows XP | 2 days ago | Windows |
| Root password | 2 days ago | Linux general |
| Where/when DNOTIFY is used? | 2 days ago | Linux kernel |
| How to convert Linux Kernel built-in module into a loadable module | 2 days ago | Linux kernel |
| Linux 2.6.24 and I/O schedulers | 2 days ago | Linux kernel |
| USB Driver -- Interrupt Polling -- A Little Help Please | 3 days ago | Linux general |
