HomeFreeBSD

Fix a bunch of issues (and a few non-issues but appeasement is easier

Description

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

Details

Committed
impDec 27 2017, 6:30 PM
Parents
rS327240: if_awg: Respect rgmii-*id PHY configurations
Branches
Unknown
Tags
Unknown