Page MenuHomeFreeBSD

epair: deduplicate interface allocation code #1
ClosedPublic

Authored by melifaro on Sep 17 2022, 8:51 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 10 2024, 7:16 AM
Unknown Object (File)
Nov 29 2024, 11:49 AM
Unknown Object (File)
Nov 28 2024, 9:41 AM
Unknown Object (File)
Oct 5 2024, 3:56 PM
Unknown Object (File)
Sep 15 2024, 12:53 AM
Unknown Object (File)
Sep 8 2024, 5:43 PM
Unknown Object (File)
Sep 8 2024, 9:42 AM
Unknown Object (File)
Sep 7 2024, 6:45 AM
Subscribers

Details

Summary

Simplify epair_clone_create() and epair_clone_destroy() by factoring out epair_softc allocation / desctruction and ifp setup/teardown into separate functions.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

melifaro retitled this revision from epair: deduplicate interface allocation code to epair: deduplicate interface allocation code #1.Sep 17 2022, 8:57 PM
melifaro edited the summary of this revision. (Show Details)
melifaro added reviewers: network, kp, glebius, bz.
This revision is now accepted and ready to land.Sep 18 2022, 12:50 PM
zlei requested changes to this revision.Sep 19 2022, 1:12 AM
zlei added a subscriber: zlei.
zlei added inline comments.
sys/net/if_epair.c
495

I think epair_alloc_sc() will prevent potential naming pollution.
Although it is modified with static but still a dedicated prefix epair_ looks consistent with current naming.

667

if (sca == NULL ^ scb == NULL), then free_sc(sca) or free_sc(scb) may trigger null pointer dereference.

This revision now requires changes to proceed.Sep 19 2022, 1:12 AM
sys/net/if_epair.c
667

Good catch!

A simple if (sc == NULL) return; in free_sc() should work, and matches the regular free() idiom.

This revision was not accepted when it landed; it landed in state Needs Revision.Sep 22 2022, 9:34 AM
This revision was automatically updated to reflect the committed changes.
melifaro marked 2 inline comments as done.
sys/net/if_epair.c
667

Yep, that's a good one!
It was my initial intention but I forgot to actually add it :-)