Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix slice init length #6715

Merged
merged 1 commit into from
Oct 7, 2024
Merged

fix: fix slice init length #6715

merged 1 commit into from
Oct 7, 2024

Conversation

cuishuang
Copy link
Contributor

The intention here should be to initialize a slice with a capacity of len(g.ChildGroups) rather than initializing the length of this slice.

The online demo: https://go.dev/play/p/q1BcVCmvidW

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank for for this fix!
@tnqn @Dyanngg do you think this is something worth backporting? I can see how this bug would not really impact functionality, but it would create some incorrect index entries, with the "" key matching all groups (but we probably never lookup that key).

@antoninbas antoninbas added kind/bug Categorizes issue or PR as related to a bug. area/network-policy Issues or PRs related to network policies. labels Oct 4, 2024
@Dyanngg
Copy link
Contributor

Dyanngg commented Oct 4, 2024

Thank for for this fix! @tnqn @Dyanngg do you think this is something worth backporting? I can see how this bug would not really impact functionality, but it would create some incorrect index entries, with the "" key matching all groups (but we probably never lookup that key).

Yes can confirm that we never use "" to look up this index

@antoninbas
Copy link
Contributor

/test-all

@antoninbas antoninbas merged commit 9ac4934 into antrea-io:main Oct 7, 2024
56 of 65 checks passed
hangyan pushed a commit to hangyan/antrea that referenced this pull request Oct 29, 2024
In pkg/controller/networkpolicy/store/group.go

Signed-off-by: cuishuang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/network-policy Issues or PRs related to network policies. kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants