aqtion-freebsd icon indicating copy to clipboard operation
aqtion-freebsd copied to clipboard

Incorrect bitwise comparison on aq_ring.c

Open jm-mikkelsen opened this issue 3 years ago • 2 comments

Building on FreeBSD 13.1 and 13.2 gives this warning:

--- aq_ring.o ---
aq_ring.c:364:37: warning: bitwise comparison always evaluates to false [-Wtautological-bitwise-compare]
                if ((rx_desc->wb.pkt_type & 0x60) == 1) {
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
1 warning generated.

This looks like it really should be != 0, but it could also be that it should be == 0. Either way, this is a bug.

jm-mikkelsen avatar Apr 12 '23 15:04 jm-mikkelsen

The equivalent functionality in the OpenBSD driver is:

                if (rxd_type & (AQ_RXDESC_TYPE_VLAN | AQ_RXDESC_TYPE_VLAN2)) {
                        m->m_pkthdr.ether_vtag = lemtoh16(&rxd->vlan);
                        m->m_flags |= M_VLANTAG;
                }

and I suspect this should be != 0, but I will need to test this first.

emaste avatar Nov 13 '25 00:11 emaste

https://reviews.freebsd.org/D53836

emaste avatar Nov 20 '25 02:11 emaste