lkml.org 
[lkml]   [2003]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: 2.6.0-test8-mm1
Date
On Monday 20 October 2003 11:05, Andrew Morton wrote:
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.0-test8/2
>.6.0-test8-mm1
~~ snip ~~
> +fix-sqrt.patch
>
> Fix int_sqrt().

I really like this one... ;-)

The problem ist that oom_kill.c assumes that int_sqrt() never returns 0. So we
could get a division by zero there :-(

The attached patch fixes that...

Regards
Thomas
--- linux-2.6.0-test8-mm1/mm/oom_kill.c.orig Mon Oct 20 12:49:58 2003
+++ linux-2.6.0-test8-mm1/mm/oom_kill.c Mon Oct 20 12:52:55 2003
@@ -63,8 +63,8 @@
cpu_time = (p->utime + p->stime) >> (SHIFT_HZ + 3);
run_time = (get_jiffies_64() - p->start_time) >> (SHIFT_HZ + 10);

- points /= int_sqrt(cpu_time);
- points /= int_sqrt(int_sqrt(run_time));
+ points /= cpu_time ? int_sqrt(cpu_time) : 1;
+ points /= run_time ? int_sqrt(int_sqrt(run_time)) : 1;

/*
* Niced processes are most likely less important, so double[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:58    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site