github-vet / github-vet/rangeloop-pointer-findings
quangtamle/NSM_lab: Labs/skydive/ovs/ovsdb/ovsdb.go; 13 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [quangtamle/NSM_lab](https://www.github.com/quangtamle/NSM_lab) at [Labs/skydive/ovs/ovsdb/ovsdb.go](https://github.com/quangtamle/NSM_lab/blob/7809bb3f1fac3eedb360db560f99545391913756/Labs/skydive/ovs/ovsdb/ovsdb.go#L376-L388)
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 tableUpdate at line 385 may start a goroutine
[Click here to see the code in its original context.](https://github.com/quangtamle/NSM_lab/blob/7809bb3f1fac3eedb360db560f99545391913756/Labs/skydive/ovs/ovsdb/ovsdb.go#L376-L388)
Click here to show the 13 line(s) of Go which triggered the analyzer.
```go
for name, tableUpdate := range updates.Updates {
switch name {
case "Interface":
o.interfaceUpdateHandler(&tableUpdate)
case "Bridge":
o.bridgeUpdateHandler(&tableUpdate)
case "Port":
o.portUpdateHandler(&tableUpdate)
case "Open_vSwitch":
o.ovsUpdateHandler(&tableUpdate)
}
}
```
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 {
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(ovsUpdate, 1)" -> {"(OnOvsUpdate, 2)";}
"(OnOvsUpdate, 2)" -> {"(New, 1)";}
"(New, 1)" -> {"(get, 1)";}
"(get, 1)" -> {"(SetTransportDefaults, 1)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
"(addConnIfNeeded, 3)" -> {}
"(ovsUpdateHandler, 1)" -> {"(ovsUpdate, 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: 7809bb3f1fac3eedb360db560f99545391913756
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in Labs/skydive/ovs/ovsdb/ovsdb.go around lines 376-388 and trace the four update handlers named in the snippet. Use the analyzer call graph to determine whether a handler can start a goroutine while retaining tableUpdate; done means deciding whether the finding is a bug, mitigated, or desirable behavior and recording that classification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100