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
F172741834: D47405.id.diff
Sun, Sep 20, 4:32 PM
F172727865: D47405.diff
Sun, Sep 20, 2:31 PM
Unknown Object (File)
Wed, Sep 9, 10:57 PM
Unknown Object (File)
Wed, Sep 9, 12:07 AM
Unknown Object (File)
Tue, Sep 8, 4:07 AM
Unknown Object (File)
Sun, Sep 6, 12:43 AM
Unknown Object (File)
Sat, Sep 5, 11:11 PM
Unknown Object (File)
Sat, Sep 5, 8:57 AM

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

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.