Skip to contentSkip to conversation

Fix try_to_freeze_tasks()'s use of do_div()

PATCH In review David Howells 3 participants 3 messages Jul 11, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix try_to_freeze_tasks()'s use of do_div()

Fix try_to_freeze_tasks()'s use of do_div() on an s64 by making elapsed_csecs64 a u64 instead and dividing that.

Possibly this should be guarded lest the interval calculation turn up negative, but the possible negativity of the result of the division is cast away anyway.

This was introduced by patch 438e2ce68dfd4af4cfcec2f873564fb921db4bb5.

---

 kernel/power/process.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/power/process.c +1 -1
index 5fb8765..278946a 100644
@@ -149,7 +149,7 @@ static int try_to_freeze_tasks(bool sig_only)
 	unsigned long end_time;
 	unsigned int todo;
 	struct timeval start, end;
-	s64 elapsed_csecs64;
+	u64 elapsed_csecs64;
 	unsigned int elapsed_csecs;
 
 	do_gettimeofday(&start);
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · David Howells

Fix try_to_freeze_tasks()'s use of do_div() on an s64 by making elapsed_csecs64 a u64 instead and dividing that.

Possibly this should be guarded lest the interval calculation turn up negative, but the possible negativity of the result of the division is cast away anyway.

This was introduced by patch 438e2ce68dfd4af4cfcec2f873564fb921db4bb5.

Quoted 22 lines

---

 kernel/power/process.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/power/process.c +1 -1
index 5fb8765..278946a 100644
@@ -149,7 +149,7 @@ static int try_to_freeze_tasks(bool sig_only)
 	unsigned long end_time;
 	unsigned int todo;
 	struct timeval start, end;
-	s64 elapsed_csecs64;
+	u64 elapsed_csecs64;
 	unsigned int elapsed_csecs;
 
 	do_gettimeofday(&start);
#2 lore raw
In reply to David Howells
Quoted 9 lines · David Howells

Fix try_to_freeze_tasks()'s use of do_div() on an s64 by making elapsed_csecs64 a u64 instead and dividing that.

Possibly this should be guarded lest the interval calculation turn up negative, but the possible negativity of the result of the division is cast away anyway.

This was introduced by patch 438e2ce68dfd4af4cfcec2f873564fb921db4bb5.

ACK.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html