lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAELBVzA-ArFvp9MRp5ZvgsEpi4ikt9Nq=zHsNSLAOiD=TqZC=w@mail.gmail.com>
Date:	Sun, 14 Aug 2011 10:44:26 -0300
From:	Kevin Winchester <kjwinchester@...il.com>
To:	hadi@...erus.ca, davem@...emloft.net
Cc:	netdev@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: sch_generic: warning: the comparison will always evaluate as ‘true’ for the address of ‘noop_qdisc’ will never be NULL

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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ