Page MenuHomeFreeBSD

pf: Simplify cleanup
ClosedPublic

Authored by kp on Mar 10 2021, 3:42 PM.

Details

Summary

We can now counter_u64_free(NULL), so remove the checks.

MFC after: 1 week
Sponsored-by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kp requested review of this revision.Mar 10 2021, 3:42 PM

Can counter ptr really be NULL is these cases? If yes, I'd rather retain the existing checks as they indicate that this a valid possibility.

Also, counter(9) man page says nothing about the free(NULL) use case.

Can counter ptr really be NULL is these cases? If yes, I'd rather retain the existing checks as they indicate that this a valid possibility.

It can happen, but really only if we fail to allocate memory (see line 520-521).

Also, counter(9) man page says nothing about the free(NULL) use case.

Until D29189 it couldn't handle that. This commit builds on top of that.

In D29190#653711, @kp wrote:

Until D29189 it couldn't handle that. This commit builds on top of that.

May you please stack them together to make this dependency explicit?

In D29190#653711, @kp wrote:

Can counter ptr really be NULL is these cases? If yes, I'd rather retain the existing checks as they indicate that this a valid possibility.

It can happen, but really only if we fail to allocate memory (see line 520-521).

Also, counter(9) man page says nothing about the free(NULL) use case.

Until D29189 it couldn't handle that. This commit builds on top of that.

Yep :-) What I'm saying is that the man page should also be updated to reflect the code changes.

Yep :-) What I'm saying is that the man page should also be updated to reflect the code changes.

Good point. How does D29215 look?

This revision was not accepted when it landed; it landed in state Needs Review.Mar 12 2021, 12:16 PM
Closed by commit R10:28dc2c954f50: pf: Simplify cleanup (authored by kp). · Explain Why
This revision was automatically updated to reflect the committed changes.