Page MenuHomeFreeBSD

Various Coverity fixes in ifconfig(8)
ClosedPublic

Authored by asomers on May 3 2017, 4:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Aug 10, 10:03 PM
Unknown Object (File)
Thu, Jul 24, 11:41 PM
Unknown Object (File)
Jul 6 2025, 8:27 PM
Unknown Object (File)
Jul 6 2025, 2:05 PM
Unknown Object (File)
Jul 6 2025, 9:30 AM
Unknown Object (File)
Jul 4 2025, 9:36 PM
Unknown Object (File)
Jul 4 2025, 9:18 PM
Unknown Object (File)
Jul 3 2025, 10:09 AM
Subscribers

Details

Summary

Various Coverity fixes in ifconfig(8)

  • Exit early if kldload(2) fails (1011259). This is the only change that affects ifconfig's behavior.
  • Close memory and resource leaks (1305624, 1305205, 1007100)
  • Mark usage() as _Noreturn (1305806, 1305750)
  • Fix some dereference after null checks (1011474, 270774)

CID: 1305624, 1305205, 1007100, 1305806, 1305750, 1011474, 270774,
CID: 1011259

Diff Detail

Event Timeline

sbin/ifconfig/af_inet6.c
360

res is uninitialized in some cases.

sbin/ifconfig/ifconfig.c
109

I believe the preferred style for declarations is to put attributes after the declaration. Like:

static void usage(void) _Noreturn;

Respond to cem's comments

LGTM other than the whitespace nit below.

sbin/ifconfig/ifconfig.c
109

Well, keep the preexisting space/tab style :-).

This revision was automatically updated to reflect the committed changes.