github-vet / github-vet/rangeloop-pointer-findings
oracle/oci-cloud-controller-manager: pkg/cloudprovider/providers/oci/load_balancer_util.go; 33 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [oracle/oci-cloud-controller-manager](https://www.github.com/oracle/oci-cloud-controller-manager) at [pkg/cloudprovider/providers/oci/load_balancer_util.go](https://github.com/oracle/oci-cloud-controller-manager/blob/220ab897fd3e8b1bd4b6b6d13a072f477453c073/pkg/cloudprovider/providers/oci/load_balancer_util.go#L324-L356)
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.
> reference to actualBackendSet was used in a composite literal at line 337
[Click here to see the code in its original context.](https://github.com/oracle/oci-cloud-controller-manager/blob/220ab897fd3e8b1bd4b6b6d13a072f477453c073/pkg/cloudprovider/providers/oci/load_balancer_util.go#L324-L356)
Click here to show the 33 line(s) of Go which triggered the analyzer.
```go
for name, actualBackendSet := range actual {
desiredBackendSet, ok := desired[name]
if !ok {
// No longer exists
backendSetActions = append(backendSetActions, &BackendSetAction{
name: *actualBackendSet.Name,
BackendSet: loadbalancer.BackendSetDetails{
HealthChecker: healthCheckerToDetails(actualBackendSet.HealthChecker),
Policy: actualBackendSet.Policy,
Backends: backendsToBackendDetails(actualBackendSet.Backends),
SessionPersistenceConfiguration: actualBackendSet.SessionPersistenceConfiguration,
SslConfiguration: sslConfigurationToDetails(actualBackendSet.SslConfiguration),
},
Ports: portsFromBackendSet(logger, *actualBackendSet.Name, &actualBackendSet),
actionType: Delete,
})
continue
}
if hasBackendSetChanged(logger, actualBackendSet, desiredBackendSet) {
oldPorts := portsFromBackendSet(logger, name, &actualBackendSet)
backendSetActions = append(backendSetActions, &BackendSetAction{
name: name,
BackendSet: desiredBackendSet,
Ports: portsFromBackendSetDetails(logger, name, &desiredBackendSet),
OldPorts: &oldPorts,
actionType: Update,
})
}
//get the Actions for the Backend changes and append it with the backendSetActions
backendSetActions = append(backendSetActions, getBackendChanges(logger, actualBackendSet, desiredBackendSet)...)
}
```
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: 220ab897fd3e8b1bd4b6b6d13a072f477453c073
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with pkg/cloudprovider/providers/oci/load_balancer_util.go around lines 324-356 and trace how actualBackendSet is referenced inside the range loop. Check the surrounding helper behavior and available tests to determine whether the analyzer finding can affect the generated backend-set actions; done means reaching a supported Bug, Mitigated, or Desirable Behavior classification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100