aqtion-freebsd
aqtion-freebsd copied to clipboard
Incorrect bitwise comparison on aq_ring.c
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.
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.
https://reviews.freebsd.org/D53836