[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090617163723.GB16128@elte.hu>
Date: Wed, 17 Jun 2009 18:37:23 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Christian Engelmayer <christian.engelmayer@...quentis.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Mike Galbraith <efault@....de>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] scheduler: access to variable out of scope in
sched_slice()
* Christian Engelmayer <christian.engelmayer@...quentis.com> wrote:
> From: Christian Engelmayer <christian.engelmayer@...quentis.com>
>
> 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.
>
> Signed-off-by: Christian Engelmayer <christian.engelmayer@...quentis.com>
> --
> Reported by static code analysis.
>
> --- linux-2.6.30/kernel/sched_fair.c.orig 2009-06-16 10:01:50.000000000 +0200
> +++ linux-2.6.30/kernel/sched_fair.c 2009-06-16 10:02:39.000000000 +0200
> @@ -430,12 +430,13 @@ static u64 sched_slice(struct cfs_rq *cf
>
> 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;
Good one!
I suspect it doesnt matter in practice because GCC will just have
them all on the same stack frame?
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists