Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Oct 2014 06:38:39 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 194506] New: [PATCH] "pciconf -a" asserts with unemerated device names
Message-ID:  <bug-194506-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
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: accornehl@fastmail.fm
                CC: benno@FreeBSD.org, markj@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-194506-8>