Commit Graph

4 Commits

Author SHA1 Message Date
Warner Losh
f77a6187eb Use strl* here too.
CID: 1383969
2017-12-27 20:33:37 +00:00
Warner Losh
3888260471 Fix a bunch of issues (and a few non-issues but appeasement is easier
than arguing) Coverity found:

o Use open + fstat rather than stat + open to avoid any races for a
  file that's static for the life of the system. This will prevent any
  problems should someone insert a new device while installing a
  kernel in the future.
o Use strlcpy instead of strcpy as a failsafe to knowing that the
  strings can't possibly be larger than the buffer due to data
  source limits (though in the future these limits might be more
  dynamic).
o If we can't find the hints file, return rather than dereference
  a NULL pointer.
o Check for lastmod before calling strcmp in case a PNP entry
  comes before a module entry. That's not allowed, but within the
  realm of crazy things programmers do.
o Free lastmod before exiting search_hints() to avoid a leak.

CID: 1383971, 1383970, 1383969, 1383965, 1383963, 1383960
2017-12-27 18:30:24 +00:00
Warner Losh
d383021fa7 Fix typo 2017-12-26 04:07:18 +00:00
Warner Losh
d9aed21ce3 Match unattached devices on the system to potential kernel modules.
devmatch(8) matchs up devices in the system device tree with drivers
that may match them. For each unattached device in the system, it
tries to find matching PNP info in the linker hints and prints modules
to load to claim the devices.

In --unbound mode, devmatch can look for drivers that have attached to
devices in the device tree and have plug and play information, but for
which no PNP info exists. This helps find drivers that haven't been
converted yet that are in use on this system.

In addition, the ability to dump out linker.hints is provided.

Future commits will add hooks to devd.conf and rc.d to fully automate
using this information.
2017-12-25 18:56:08 +00:00