Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e722dfcb authored by Jin Qian's avatar Jin Qian Committed by Amit Pundir
Browse files

ANDROID: uid_cputime: fix cputime overflow



Converting cputime_t to usec caused overflow when the value is greater
than 1 hour. Use msec and convert to unsigned long long to support bigger
range.

Bug: 22461683

Change-Id: I853fe3e8e7dbf0d3e2cc5c6f9688a5a6e1f1fb3e
Signed-off-by: default avatarJin Qian <jinqian@google.com>

[AmitP: Refactored the original changes because cputime_to_jiffies()
        is obsolete and removed in upstream commit
        f22d6df0 ("sched/cputime: Remove jiffies based cputime")]
Signed-off-by: default avatarAmit Pundir <amit.pundir@linaro.org>
parent 610646ec
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -108,9 +108,8 @@ static int uid_stat_show(struct seq_file *m, void *v)
							uid_entry->active_utime;
		u64 total_stime = uid_entry->stime +
							uid_entry->active_stime;
		seq_printf(m, "%d: %u %u\n", uid_entry->uid,
						cputime_to_usecs(total_utime),
						cputime_to_usecs(total_stime));
		seq_printf(m, "%d: %llu %llu\n", uid_entry->uid,
			ktime_to_ms(total_utime), ktime_to_ms(total_stime));
	}

	mutex_unlock(&uid_lock);