Page MenuHomeFreeBSD

inpcb: Remove checks for NULL credential references
ClosedPublic

Authored by markj on Oct 17 2022, 8:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Feb 14, 10:01 PM
Unknown Object (File)
Sat, Feb 14, 8:00 PM
Unknown Object (File)
Sun, Feb 8, 7:22 AM
Unknown Object (File)
Sat, Feb 7, 11:40 PM
Unknown Object (File)
Fri, Jan 30, 4:05 PM
Unknown Object (File)
Jan 12 2026, 9:31 AM
Unknown Object (File)
Dec 28 2025, 12:26 PM
Unknown Object (File)
Dec 24 2025, 6:52 PM

Details

Summary

Some auditing of the code shows that "cred" is never non-NULL in these
functions, either because all callers pass a non-NULL reference or
because they unconditionally dereference "cred". So, let's simplify the
code a bit and remove NULL checks. No functional change intended.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 47862
Build 44749: arc lint + arc unit

Event Timeline

markj requested review of this revision.Oct 17 2022, 8:39 PM
glebius added inline comments.
sys/netinet/in_pcb.c
1171

May be add documenting MPASS(cred) here and in other functions?

This revision is now accepted and ready to land.Oct 18 2022, 4:27 AM
sys/netinet/in_pcb.c
1171

If you really prefer it I will do it, but to me it's overkill. These functions are not providing general-purpose interfaces, so it's ok to make assumptions like this IMO.

sys/netinet/in_pcb.c
1171

Just suggested! If you disagree, let it be your way :)