Page MenuHomeFreeBSD

epair: deduplicate interface allocation code #1
ClosedPublic

Authored by melifaro on Sep 17 2022, 8:51 PM.
Tags
None
Referenced Files
F121990722: D36614.id110843.diff
Tue, Jul 1, 6:14 AM
Unknown Object (File)
Mon, Jun 30, 7:05 AM
Unknown Object (File)
Mon, Jun 30, 6:12 AM
Unknown Object (File)
Sun, Jun 29, 12:59 PM
Unknown Object (File)
Sat, Jun 28, 11:15 PM
Unknown Object (File)
Sat, Jun 28, 12:51 PM
Unknown Object (File)
Sat, Jun 28, 7:56 AM
Unknown Object (File)
Thu, Jun 26, 11:35 PM
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 :-)