Page MenuHomeFreeBSD

pf: Fix a use of an uninitialized variable
ClosedPublic

Authored by markj on Nov 2 2024, 7:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jan 5, 8:54 PM
Unknown Object (File)
Dec 10 2024, 11:40 AM
Unknown Object (File)
Nov 21 2024, 3:25 PM
Unknown Object (File)
Nov 15 2024, 6:19 AM
Unknown Object (File)
Nov 7 2024, 1:23 PM
Unknown Object (File)
Nov 7 2024, 12:50 AM
Unknown Object (File)
Nov 4 2024, 10:50 PM
Unknown Object (File)
Nov 3 2024, 4:48 PM

Details

Summary

pf_find_state_all() expects the caller to initialize "*more" if it is
non-NULL.

Reported by: KMSAN

Diff Detail

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

Event Timeline

markj requested review of this revision.Nov 2 2024, 7:58 PM

Should we add MPASS(more == NULL || *more == 0) in pf_find_state_all()?

This revision is now accepted and ready to land.Nov 3 2024, 1:56 PM
In D47405#1081320, @kp wrote:

Should we add MPASS(more == NULL || *more == 0) in pf_find_state_all()?

On reflection, I think we should fix this by having pf_find_staye_all() initialise *more to 0, because if we don’t find anything that’s the correct thing to return.

In D47405#1081337, @kp wrote:
In D47405#1081320, @kp wrote:

Should we add MPASS(more == NULL || *more == 0) in pf_find_state_all()?

On reflection, I think we should fix this by having pf_find_staye_all() initialise *more to 0, because if we don’t find anything that’s the correct thing to return.

Yeah, I was just about to make that change. I think all callers should initialize *more = 0 to avoid extra diffs with OpenBSD, but pf_find_state_all() should also be careful to initialize *more.

Initialize *more in both places.

This revision now requires review to proceed.Nov 3 2024, 2:25 PM
This revision is now accepted and ready to land.Nov 3 2024, 2:32 PM
This revision was automatically updated to reflect the committed changes.