Page MenuHomeFreeBSD

rack_bbr_common: uninitialized *ret_val in ctf_drop_checks()
AbandonedPublic

Authored by thebugfixers_pm.me on Wed, Jun 24, 1:20 PM.
Tags
None
Referenced Files
F161618930: D57817.id.diff
Sun, Jul 5, 8:46 AM
F161611675: D57817.id180528.diff
Sun, Jul 5, 7:33 AM
F161600968: D57817.id180528.diff
Sun, Jul 5, 6:13 AM
F161554623: D57817.diff
Sat, Jul 4, 8:05 PM
Unknown Object (File)
Fri, Jul 3, 6:39 PM
Unknown Object (File)
Fri, Jul 3, 6:37 PM
Unknown Object (File)
Fri, Jul 3, 11:59 AM
Unknown Object (File)
Tue, Jun 30, 8:33 PM

Details

Summary

On the success path the function return (0); without assigning *ret_val.

The existing comment says the function “places in ret_val what should be returned.”

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

ret_val is only considered by the caller if ctf_drop_checks() returns 1. So there is no problem in leaving it unassigned when returning 0. So the proposed fix would not change the behavior. So I would tend to not add the proposed change, but let us get glebius into the loop. Maybe improving the comment is the best way forward.

glebius requested changes to this revision.Sun, Jun 28, 6:00 PM

Yes, patch as is doesn't improve anything. The comment above the function clearly marks the intent: the function checks if packet should be dropped and if so provides error code. It doesn't provide error code in case packet shouldn't be dropped.

P.S. For the sake of human comprehension I would make the function bool and rename the ret_val to error.

This revision now requires changes to proceed.Sun, Jun 28, 6:00 PM

Yes, patch as is doesn't improve anything. The comment above the function clearly marks the intent: the function checks if packet should be dropped and if so provides error code. It doesn't provide error code in case packet shouldn't be dropped.

P.S. For the sake of human comprehension I would make the function bool and rename the ret_val to error.

It might make sense to rename ret_val to locked, which is boolean. This would apply to a couple of functions, The same for changing the type to bool. I can take a look...