[Bug 194506] New: [PATCH] "pciconf -a" asserts with unemerated device names

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Oct 21 06:38:39 UTC 2014


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 at FreeBSD.org
          Reporter: accornehl at fastmail.fm
                CC: benno at FreeBSD.org, markj at 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.


More information about the freebsd-bugs mailing list