Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jan 2011 19:56:15 +0100
From:      Roman Divacky <rdivacky@freebsd.org>
To:        current@freebsd.org
Subject:   [RFC]: tautological compares in amd64 GENERIC
Message-ID:  <20110117185615.GA64182@freebsd.org>

next in thread | raw e-mail | index | archive | help

--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

hi,

clang found these problems in our amd64 GENERIC:

some of these may be real bugs lurking in our code - can the respective own=
ers
of the subsystems take a look? The bugs cover all areas from ufs/vm to=20
net*/security.

Thank you!

roman

cam/cam_periph.c:530:28: warning: comparison of unsigned expression < 0 is =
always false [-Wtautological-compare]
        else if (periph->refcount < 0)
                 ~~~~~~~~~~~~~~~~ ^ ~

kern/uipc_syscalls.c:347:16: warning: comparison of unsigned expression < 0=
 is always false [-Wtautological-compare]
                if (*namelen < 0)
                    ~~~~~~~~ ^ ~

kern/uipc_syscalls.c:1472:12: warning: comparison of unsigned expression < =
0 is always false [-Wtautological-compare]
        if (*alen < 0)
            ~~~~~ ^ ~

kern/uipc_syscalls.c:1572:12: warning: comparison of unsigned expression < =
0 is always false [-Wtautological-compare]
        if (*alen < 0)
            ~~~~~ ^ ~

ufs/ffs/ffs_inode.c:538:24: warning: comparison of unsigned expression < 0 =
is always false [-Wtautological-compare]
        if (DIP(ip, i_blocks) < 0)                      /* sanity */
            ~~~~~~~~~~~~~~~~~ ^ ~

ufs/ufs/ufs_quota.c:329:44: warning: comparison of unsigned expression >=3D=
 0 is always true [-Wtautological-compare]
                        if (dq->dq_curinodes !=3D 0 && ncurinodes >=3D 0)
                                                     ~~~~~~~~~~ ^  ~

ufs/ufs/ufs_quota.c:367:21: warning: comparison of unsigned expression >=3D=
 0 is always true [-Wtautological-compare]
                                            ncurinodes >=3D 0)
                                            ~~~~~~~~~~ ^  ~

vm/vm_pageout.c:1701:14: warning: comparison of unsigned expression >=3D 0 =
is always true [-Wtautological-compare]
                        if (limit >=3D 0 && size >=3D limit) {
                            ~~~~~ ^  ~

amd64/amd64/sys_machdep.c:562:16: warning: comparison of unsigned expressio=
n < 0 is always false [-Wtautological-compare]
                    uap->num < 0 || largest_ld > max_ldt_segment)
                    ~~~~~~~~ ^ ~


netinet6/in6_mcast.c:1849:30: warning: comparison of unsigned expression < =
0 is always false [-Wtautological-compare]
                        if (mreq.ipv6mr_interface < 0 ||
                            ~~~~~~~~~~~~~~~~~~~~~ ^ ~

netinet6/in6_mcast.c:2196:15: warning: comparison of unsigned expression < =
0 is always false [-Wtautological-compare]
                if (ifindex < 0 || V_if_index < ifindex)
                    ~~~~~~~ ^ ~

netinet6/in6_mcast.c:2354:14: warning: comparison of unsigned expression < =
0 is always false [-Wtautological-compare]
        if (ifindex < 0 || V_if_index < ifindex)
            ~~~~~~~ ^ ~

netinet6/ip6_output.c:2542:29: warning: comparison of unsigned expression <=
 0 is always false [-Wtautological-compare]
                    pktinfo->ipi6_ifindex < 0) {
                    ~~~~~~~~~~~~~~~~~~~~~ ^ ~

netinet6/scope6.c:391:15: warning: comparison of unsigned expression < 0 is=
 always false [-Wtautological-compare]
                        if (zoneid < 0 || V_if_index < zoneid)
                            ~~~~~~ ^ ~

security/audit/audit_syscalls.c:306:39: warning: comparison of unsigned exp=
ression < 0 is always false [-Wtautological-compare]
                            (udata.au_qctrl64.aq64_minfree < 0) ||


security/mac/mac_framework.c:589:20: warning: comparison of unsigned expres=
sion < 0 is always false [-Wtautological-compare]
        if (mac->m_buflen < 0 ||
            ~~~~~~~~~~~~~ ^ ~

dev/acpica/acpi_pci.c:284:24: warning: comparison of unsigned expression < =
0 is always false [-Wtautological-compare]
        if (pcib_get_bus(dev) < 0)
            ~~~~~~~~~~~~~~~~~ ^ ~

dev/buslogic/bt.c:978:16: warning: comparison of unsigned enum expression >=
=3D 0 is always true [-Wtautological-compare]
        if (bio_index >=3D 0 && bio_index < BT_NUM_ISAPORTS)
            ~~~~~~~~~ ^  ~

dev/cs/if_cs.c:367:12: warning: comparison of unsigned expression >=3D 0 is=
 always true [-Wtautological-compare]
                        if (irq >=3D 0 || irq < 16)
                            ~~~ ^  ~

dev/sym/sym_hipd.c:3449:10: warning: comparison of unsigned expression < 0 =
is always false [-Wtautological-compare]
        if (fak < 0)    {fak =3D 0; ret =3D -1;}
            ~~~ ^ ~

dev/usb/serial/usb_serial.c:1056:18: warning: comparison of unsigned expres=
sion < 0 is always false [-Wtautological-compare]
        if (t->c_ospeed < 0) {
            ~~~~~~~~~~~ ^ ~




--LQksG6bCIzRHxTLp
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)

iEYEARECAAYFAk00kM8ACgkQLVEj6D3CBEyugQCfZDDRaJwG1HKH6tJH1s5cZoHx
czYAmwRi5mW8I8Odgt0com6VZgWkJZNc
=m5JP
-----END PGP SIGNATURE-----

--LQksG6bCIzRHxTLp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110117185615.GA64182>