Skip to content

Commit

Permalink
sched: Fix out of scope variable access in sched_slice()
Browse files Browse the repository at this point in the history
Access to local variable lw is aliased by usage of pointer load.
Access to pointer load in calc_delta_mine() happens when lw is
already out of scope.

[ Reported by static code analysis. ]

Signed-off-by: Christian Engelmayer <christian.engelmayer@frequentis.com>
LKML-Reference: <20090616103512.0c846e51@frequentis.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Christian Engelmayer authored and Ingo Molnar committed Jun 17, 2009
1 parent 348ec61 commit 3104bf0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,13 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se)

for_each_sched_entity(se) {
struct load_weight *load;
struct load_weight lw;

cfs_rq = cfs_rq_of(se);
load = &cfs_rq->load;

if (unlikely(!se->on_rq)) {
struct load_weight lw = cfs_rq->load;
lw = cfs_rq->load;

update_load_add(&lw, se->load.weight);
load = &lw;
Expand Down

0 comments on commit 3104bf0

Please sign in to comment.