github-vet / github-vet/rangeloop-pointer-findings
openshift/sdn: pkg/network/node/networkpolicy.go; 8 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [openshift/sdn](https://www.github.com/openshift/sdn) at [pkg/network/node/networkpolicy.go](https://github.com/openshift/sdn/blob/9b44e03b1e009d363fd5b4c3b08cd721ca676e86/pkg/network/node/networkpolicy.go#L163-L170)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
> function call which takes a reference to policy at line 169 may start a goroutine
[Click here to see the code in its original context.](https://github.com/openshift/sdn/blob/9b44e03b1e009d363fd5b4c3b08cd721ca676e86/pkg/network/node/networkpolicy.go#L163-L170)
Click here to show the 8 line(s) of Go which triggered the analyzer.
```go
for _, policy := range policies.Items {
vnid, err := np.vnids.getVNID(policy.Namespace)
if err != nil {
continue
}
npns := np.namespaces[vnid]
np.updateNetworkPolicy(npns, &policy)
}
```
Click here to show extra information the analyzer produced.
```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(updateNetworkPolicy, 2)" -> {"(parseNetworkPolicy, 2)";}
"(selectPods, 2)" -> {"(LabelSelectorAsSelector, 1)";}
"(newClient, 1)" -> {"(NewMaintenance, 1)";}
"(Run, 1)" -> {}
"(Add, 2)" -> {"(Write, 3)";}
"(Dial, 1)" -> {"(Write, 1)";}
"(selectPodsFromNamespaces, 2)" -> {"(LabelSelectorAsSelector, 1)";}
"(Start, 1)" -> {"(Run, 1)";}
"(Write, 1)" -> {"(append, 1)";"(Copy, 2)";"(Capture, 2)";}
"(append, 1)" -> {}
"(writeJSON, 4)" -> {"(Write, 1)";}
"(NewMaintenance, 1)" -> {"(Dial, 1)";}
"(New, 1)" -> {"(newClient, 1)";"(get, 1)";"(New, 2)";}
"(Write, 3)" -> {"(writeJSON, 4)";"(writeXML, 4)";}
"(Copy, 2)" -> {"(ServeHTTP, 2)";}
"(configureTransports, 1)" -> {"(addConnIfNeeded, 3)";}
"(addConnIfNeeded, 3)" -> {}
"(parseNetworkPolicy, 2)" -> {"(selectPods, 2)";"(selectNamespaces, 1)";"(selectPodsFromNamespaces, 2)";}
"(New, 2)" -> {"(Start, 1)";"(Run, 1)";}
"(configureHTTP2Transport, 1)" -> {"(ConfigureTransports, 1)";}
"(ServeHTTP, 2)" -> {}
"(LabelSelectorAsSelector, 1)" -> {"(Add, 1)";}
"(ConfigureTransports, 1)" -> {"(configureTransports, 1)";}
"(Capture, 2)" -> {}
"(SetTransportDefaults, 1)" -> {"(configureHTTP2Transport, 1)";}
"(Add, 1)" -> {"(New, 1)";"(Add, 2)";}
"(get, 1)" -> {"(SetTransportDefaults, 1)";"(Run, 1)";}
"(selectNamespaces, 1)" -> {"(LabelSelectorAsSelector, 1)";}
"(writeXML, 4)" -> {"(Write, 1)";}
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 9b44e03b1e009d363fd5b4c3b08cd721ca676e86
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.