https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194506

            Bug ID: 194506
           Summary: [PATCH] "pciconf -a" asserts with unemerated device
                    names
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: Needs Triage
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: accorn...@fastmail.fm
                CC: be...@freebsd.org, ma...@freebsd.org

Created attachment 148530
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=148530&action=edit
patch

I noticed that passing an unenumerated device name to pciconf caused an assert,
for what otherwise looks like valid input.

# /usr/sbin/pciconf -a bge
Assertion failed: (*cp == '\0'), function getdevice, file
/usr/home/acornehl/freebsd/usr.sbin/pciconf/pciconf.c, line 677.
Abort trap (core dumped)

# /usr/sbin/pciconf -a bge0
bge0: attached

The function, getdevice(), expects that the device name is enumerated before
processing the string, and hits the assert when it isn't. I've added a small
patch checking before walking the string to check if it is enumerated or not
and returning an error instead of an assert.

# ./pciconf -a bge
pciconf: Device not found

# ./pciconf -a bge0
bge0: attached

# ./pciconf -a foobar
pciconf: Device not found

# ./pciconf -a foobar0
pciconf: Device not found

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to