public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [smatch] sched_fair: check after dereference
@ 2010-12-20  6:10 Dan Carpenter
  2010-12-24  9:17 ` Paul Turner
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-12-20  6:10 UTC (permalink / raw)
  To: Paul Turner; +Cc: Peter Zijlstra, linux-kernel

Hi Paul,

In linux-next e33078baa4 "sched: Fix update_cfs_load() synchronization"
introduced a dereference before the check for NULL.  I don't know the
code well enough to say if it's a bug or if the check can be removed.

kernel/sched_fair.c +728 update_cfs_load(6)
	warn: variable dereferenced before check 'cfs_rq'

   722  static void update_cfs_load(struct cfs_rq *cfs_rq, int global_update)
   723  {
   724          u64 period = sysctl_sched_shares_window;
   725          u64 now, delta;
   726          unsigned long load = cfs_rq->load.weight;
                                     ^^^^^^^^^^^^^^^^^^^
   727
   728          if (!cfs_rq)
                     ^^^^^^
   729                  return;

Can you take a look?

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [smatch] sched_fair: check after dereference
  2010-12-20  6:10 [smatch] sched_fair: check after dereference Dan Carpenter
@ 2010-12-24  9:17 ` Paul Turner
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Turner @ 2010-12-24  9:17 UTC (permalink / raw)
  To: Dan Carpenter, Paul Turner, Peter Zijlstra, linux-kernel

Sorry for delayed response -- was travelling, currently home for
holidays on terrible (satellite) internet.

On Mon, Dec 20, 2010 at 1:10 AM, Dan Carpenter <error27@gmail.com> wrote:
> Hi Paul,
>
> In linux-next e33078baa4 "sched: Fix update_cfs_load() synchronization"
> introduced a dereference before the check for NULL.  I don't know the
> code well enough to say if it's a bug or if the check can be removed.
>

This should be stale.  Now that we issue versus the queuing cfs_rq as
opposed to the group cfs_rq the passed pointer should always be valid.

If you want to send a patch I'll ack it, otherwise I can send one out
in the morning.

Thanks!

- Paul

> kernel/sched_fair.c +728 update_cfs_load(6)
>        warn: variable dereferenced before check 'cfs_rq'
>
>   722  static void update_cfs_load(struct cfs_rq *cfs_rq, int global_update)
>   723  {
>   724          u64 period = sysctl_sched_shares_window;
>   725          u64 now, delta;
>   726          unsigned long load = cfs_rq->load.weight;
>                                     ^^^^^^^^^^^^^^^^^^^
>   727
>   728          if (!cfs_rq)
>                     ^^^^^^
>   729                  return;
>
> Can you take a look?
>
> regards,
> dan carpenter
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-24  9:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-20  6:10 [smatch] sched_fair: check after dereference Dan Carpenter
2010-12-24  9:17 ` Paul Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox