Created attachment 148530 [details] 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
A commit references this bug: Author: markj Date: Wed Oct 22 23:35:57 UTC 2014 New revision: 273488 URL: https://svnweb.freebsd.org/changeset/base/273488 Log: Fix some buglets in the error-handling of getdevice(). In particular, report an error if the argument to pciconf -a doesn't have a unit number, rather than triggering an assertion failure. PR: 194506 Reported by: Anthony Cornehl <accornehl@gmail.com> Sponsored by: EMC / Isilon Storage Division Changes: head/usr.sbin/pciconf/pciconf.c
A commit references this bug: Author: markj Date: Wed Dec 3 19:44:23 UTC 2014 New revision: 275465 URL: https://svnweb.freebsd.org/changeset/base/275465 Log: MFC r273488: Fix some bugs in the error handling of getdevice(). PR: 194506 Changes: _U stable/10/ stable/10/usr.sbin/pciconf/pciconf.c
A commit references this bug: Author: markj Date: Wed Dec 3 19:44:24 UTC 2014 New revision: 275466 URL: https://svnweb.freebsd.org/changeset/base/275466 Log: MFC r273488: Fix some bugs in the error handling of getdevice(). PR: 194506 Changes: _U stable/9/usr.sbin/pciconf/ stable/9/usr.sbin/pciconf/pciconf.c