Page MenuHomeFreeBSD

Various Coverity fixes in ifconfig(8)
ClosedPublic

Authored by asomers on May 3 2017, 4:27 PM.
Tags
None
Referenced Files
F83670007: D10587.id27981.diff
Mon, May 13, 9:27 AM
F83647761: D10587.id27985.diff
Mon, May 13, 1:55 AM
F83634104: D10587.id.diff
Sun, May 12, 10:25 PM
Unknown Object (File)
Sun, May 12, 4:10 PM
Unknown Object (File)
Sun, Apr 28, 6:51 PM
Unknown Object (File)
Feb 8 2024, 6:28 PM
Unknown Object (File)
Dec 20 2023, 2:40 AM
Unknown Object (File)
Nov 22 2023, 7:08 PM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sbin/ifconfig/af_inet6.c
358 ↗(On Diff #27981)

res is uninitialized in some cases.

sbin/ifconfig/ifconfig.c
109 ↗(On Diff #27981)

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 ↗(On Diff #27984)

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

This revision was automatically updated to reflect the committed changes.