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)
Sep 28 2024, 4:15 AM
Unknown Object (File)
Sep 27 2024, 4:16 AM
Unknown Object (File)
Sep 26 2024, 4:34 PM
Unknown Object (File)
Sep 25 2024, 3:37 AM
Unknown Object (File)
Sep 22 2024, 6:55 PM
Unknown Object (File)
Sep 21 2024, 9:21 AM
Unknown Object (File)
Sep 19 2024, 12:02 PM
Unknown Object (File)
Sep 4 2024, 5:20 AM

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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

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
1132–1133

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
1132–1133

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