github-vet / github-vet/rangeloop-pointer-findings
NetApp/trident: operator/controllers/provisioner/installer/installer.go; 16 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [NetApp/trident](https://www.github.com/NetApp/trident) at [operator/controllers/provisioner/installer/installer.go](https://github.com/NetApp/trident/blob/62ab24d23195b6616334fb7d17fe4a629dda67fe/operator/controllers/provisioner/installer/installer.go#L1470-L1485)
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 deployment is reassigned at line 1476
[Click here to see the code in its original context.](https://github.com/NetApp/trident/blob/62ab24d23195b6616334fb7d17fe4a629dda67fe/operator/controllers/provisioner/installer/installer.go#L1470-L1485)
Click here to show the 16 line(s) of Go which triggered the analyzer.
```go
for _, deployment := range deployments {
if deployment.Namespace == i.namespace && deployment.Name == deploymentName {
// Found a deployment named in the same namespace
log.Infof("A Trident deployment named '%s' was found by label in CR namespace '%s'.", deploymentName,
i.namespace)
currentDeployment = &deployment
createDeployment = false
} else {
log.Errorf("a Trident deployment %s was found by label in namespace '%s', "+
"which does not meet either name %s or namespace '%s' requirement, marking it for deletion",
deployment.Name, deployment.Namespace, deploymentName, i.namespace)
unwantedDeployments = append(unwantedDeployments, deployment)
}
}
```
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: 62ab24d23195b6616334fb7d17fe4a629dda67fe
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with operator/controllers/provisioner/installer/installer.go around lines 1470-1485 and read the surrounding deployment discovery logic. Determine whether the range-loop reference assigned to currentDeployment can identify the wrong deployment, then inspect nearby tests or add coverage for the reported case. Done means the behavior is confirmed or disproved and the deployment selection is verified by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100