lkml.org 
[lkml]   [2005]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] sched: fix never executed code due to expression always false

* Jesper Juhl <juhl-lkml@dif.dk> wrote:

> As per this patch perhaps? :
>
> Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>

this is still not enough (there was one more comparison to cover). Also,
it's a bit cleaner to just cast the left side to signed than cast every
member separately.

Ingo

--

fix signed comparisons of long long.

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -2695,9 +2695,9 @@ need_resched_nonpreemptible:

schedstat_inc(rq, sched_cnt);
now = sched_clock();
- if (likely((long long)now - prev->timestamp < NS_MAX_SLEEP_AVG)) {
+ if (likely((long long)(now - prev->timestamp) < NS_MAX_SLEEP_AVG)) {
run_time = now - prev->timestamp;
- if (unlikely((long long)now - prev->timestamp < 0))
+ if (unlikely((long long)(now - prev->timestamp) < 0))
run_time = 0;
} else
run_time = NS_MAX_SLEEP_AVG;
@@ -2775,7 +2775,7 @@ go_idle:

if (!rt_task(next) && next->activated > 0) {
unsigned long long delta = now - next->timestamp;
- if (unlikely((long long)now - next->timestamp < 0))
+ if (unlikely((long long)(now - next->timestamp) < 0))
delta = 0;

if (next->activated == 1)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-04-15 10:02    [W:0.064 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site