diff options
author | Jan Beulich <JBeulich@suse.com> | 2015-01-23 08:25:38 +0000 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-01-28 13:14:12 +0100 |
commit | 81907478c4311a679849216abf723999184ab984 (patch) | |
tree | 04441020e5b21cd0c28822937eafd69cbc34057d /include/linux | |
parent | 4adca1cbc4cedb31aba03497b3de238ea13b566a (diff) | |
download | op-kernel-dev-81907478c4311a679849216abf723999184ab984.zip op-kernel-dev-81907478c4311a679849216abf723999184ab984.tar.gz |
sched/fair: Avoid using uninitialized variable in preferred_group_nid()
At least some gcc versions - validly afaict - warn about potentially
using max_group uninitialized: There's no way the compiler can prove
that the body of the conditional where it and max_faults get set/
updated gets executed; in fact, without knowing all the details of
other scheduler code, I can't prove this either.
Generally the necessary change would appear to be to clear max_group
prior to entering the inner loop, and break out of the outer loop when
it ends up being all clear after the inner one. This, however, seems
inefficient, and afaict the same effect can be achieved by exiting the
outer loop when max_faults is still zero after the inner loop.
[ mingo: changed the solution to zero initialization: uninitialized_var()
needs to die, as it's an actively dangerous construct: if in the future
a known-proven-good piece of code is changed to have a true, buggy
uninitialized variable, the compiler warning is then supressed...
The better long term solution is to clean up the code flow, so that
even simple minded compilers (and humans!) are able to read it without
getting a headache. ]
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/54C2139202000078000588F7@mail.emea.novell.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions