#2370 assigned defect

rtems/c/src/lib/libbsp/powerpc/mvme5500/network/if_1GHz/if_wm.c:1560: possible bad if ?

Reported by: David Binderman Owned by: Needs Funding
Priority: normal Milestone: Indefinite
Component: unspecified Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

[rtems/c/src/lib/libbsp/powerpc/mvme5500/network/if_1GHz/if_wm.c:1560]: (style) Expression '(X & 0xe) == 0x1' is always false.

Source code is

/* XXX Hardware bug?? */

if ((reg & 0xe) == 1) {

Change History (7)

comment:1 Changed on 07/14/15 at 20:19:51 by Joel Sherrill

I didn't check this file but assume it is based on the one in NetBSD.

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pci/if_wm.c?rev=1.336&content-type=text/x-cvsweb-markup&only_with_tag=MAIN

Double check me but I think the code is now this:

/* XXX Hardware bug?? */
if (sc->sc_type == WM_T_82544 && (reg & 0xe) == 1) {

bit = CSR_READ(sc, mta_reg + ((reg - 1) << 2));

That looks better to me.

If that resolves the issue and the code still works, update this ticket with a patch.

comment:2 Changed on 07/14/15 at 20:37:34 by Gedare Bloom

Problem is that masking off 0xe removes the 1 bit, so anything & 0xe != 1 ever.

comment:3 Changed on 07/14/15 at 20:50:21 by Joel Sherrill

So the code is still broken on the NetBSD head?

comment:4 Changed on 07/14/15 at 20:57:57 by Gedare Bloom

Well, the second part of the condition is a nop. I have no idea what the intent of this was.

comment:5 Changed on 07/14/15 at 21:23:17 by Joel Sherrill

This driver is for an Intel NIC. The driver (by name) is not in FreeBSD. The NIC is likely in the e1000/ driver directory in the FreeBSD source. The FreeBSD driver covers a much larger set of NICs and I can't find the corresponding source to check.

comment:6 Changed on 01/26/17 at 07:16:00 by Sebastian Huber

Milestone: 4.11.14.11.2

comment:7 Changed on 02/15/17 at 13:37:51 by Sebastian Huber

Milestone: 4.11.2Indefinite
Owner: set to Needs Funding
Status: newassigned
Note: See TracTickets for help on using tickets.