linux-uconsole/kernel/sched
Mateusz Guzik 4aba6e3634 sched: Fix possible divide by zero in avg_atom() calculation
commit b0ab99e773 upstream.

proc_sched_show_task() does:

  if (nr_switches)
	do_div(avg_atom, nr_switches);

nr_switches is unsigned long and do_div truncates it to 32 bits, which
means it can test non-zero on e.g. x86-64 and be truncated to zero for
division.

Fix the problem by using div64_ul() instead.

As a side effect calculations of avg_atom for big nr_switches are now correct.

Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1402750809-31991-1-git-send-email-mguzik@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-28 08:00:07 -07:00
..
auto_group.c sched/autogroup: Fix race with task_groups list 2014-03-31 09:58:14 -07:00
auto_group.h Revert "sched/autogroup: Fix crash on reboot when autogroup is disabled" 2012-12-11 10:23:45 +01:00
clock.c sched_clock: Prevent 64bit inatomicity on 32bit systems 2013-04-08 11:50:44 +02:00
core.c sched: Fix hotplug vs. set_cpus_allowed_ptr() 2014-06-11 12:03:24 -07:00
cpuacct.c sched/cpuacct/UML: Fix header file dependency bug on the UML build 2013-04-10 15:12:41 +02:00
cpuacct.h sched/cpuacct: Initialize root cpuacct earlier 2013-04-10 13:54:20 +02:00
cpupri.c sched: Use CPUPRI_NR_PRIORITIES instead of MAX_RT_PRIO in cpupri check 2014-06-11 12:03:21 -07:00
cpupri.h
cputime.c sched: Sanitize irq accounting madness 2014-06-11 12:03:21 -07:00
debug.c sched: Fix possible divide by zero in avg_atom() calculation 2014-07-28 08:00:07 -07:00
fair.c sched: Fix double normalization of vruntime 2014-03-23 21:38:09 -07:00
features.h mutex: Move mutex spinning code from sched/core.c back to mutex.c 2013-04-19 09:33:34 +02:00
idle_task.c sched: Keep at least 1 tick per second for active dynticks tasks 2013-05-04 08:32:02 +02:00
Makefile sched: Split cpuacct code out of core.c 2013-04-10 13:54:15 +02:00
rt.c sched/rt: Fix rq's cpupri leak while enqueue/dequeue child RT entities 2014-01-09 12:24:21 -08:00
sched.h sched: Fix race on toggling cfs_bandwidth_used 2014-01-15 15:28:54 -08:00
stats.c fix a leak in /proc/schedstats 2013-04-29 15:41:45 -04:00
stats.h
stop_task.c sched: Fix migration thread runtime bogosity 2012-08-13 18:41:55 +02:00