All of lore.kernel.org
 help / color / mirror / Atom feed
* sch_generic: warning: the comparison will always evaluate as ‘true’ for the address of ‘noop_qdisc’ will never be NULL
@ 2011-08-14 13:44 Kevin Winchester
  2011-08-14 17:39 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Winchester @ 2011-08-14 13:44 UTC (permalink / raw)
  To: hadi, davem; +Cc: netdev, LKML

With:

gcc (GCC) 4.6.1

I noticed the following warning appearing in my build:

net/sched/sch_generic.c: In function ‘dev_graft_qdisc’:
net/sched/sch_generic.c:678:2: warning: the comparison will always
evaluate as ‘true’ for the address of ‘noop_qdisc’ will never be NULL
[-Waddress]

The code in question runs:


        /* ... and graft new one */
        if (qdisc == NULL)
                qdisc = &noop_qdisc;
        dev_queue->qdisc_sleeping = qdisc;
        rcu_assign_pointer(dev_queue->qdisc, &noop_qdisc);

where rcu_assign_pointer has a null check that does not apply to
noop_qdisc, which will never be null.

My question is, should that really be assigning &noop_qdisc in there?
It seems odd to assign &noop_qdisc to qdisc only if qdisc is null, and
then unconditionally assign &noop_qdisc into dev_queue->qdisc.

Should the line be:

        rcu_assign_pointer(dev_queue->qdisc, qdisc);

instead?

Just curious,

-- 
Kevin Winchester

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

end of thread, other threads:[~2011-08-14 17:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-14 13:44 sch_generic: warning: the comparison will always evaluate as ‘true’ for the address of ‘noop_qdisc’ will never be NULL Kevin Winchester
2011-08-14 17:39 ` Eric Dumazet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.