#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 Jul 14, 2015 at 8:19:51 PM 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 Jul 14, 2015 at 8:37:34 PM by Gedare

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

comment:3 Changed on Jul 14, 2015 at 8:50:21 PM by Joel Sherrill

So the code is still broken on the NetBSD head?

comment:4 Changed on Jul 14, 2015 at 8:57:57 PM by Gedare

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

comment:5 Changed on Jul 14, 2015 at 9:23:17 PM 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 Jan 26, 2017 at 7:16:00 AM by Sebastian Huber

Milestone: 4.11.14.11.2

comment:7 Changed on Feb 15, 2017 at 1:37:51 PM by Sebastian Huber

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