github-vet / github-vet/rangeloop-pointer-findings
openshift/csi-driver-projected-resource: pkg/hostpath/hostpath.go; 19 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [openshift/csi-driver-projected-resource](https://www.github.com/openshift/csi-driver-projected-resource) at [pkg/hostpath/hostpath.go](https://github.com/openshift/csi-driver-projected-resource/blob/dc73b78c4a27f357ae274864971adbeee2b0e900/pkg/hostpath/hostpath.go#L592-L610)
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 v is reassigned at line 605
[Click here to see the code in its original context.](https://github.com/openshift/csi-driver-projected-resource/blob/dc73b78c4a27f357ae274864971adbeee2b0e900/pkg/hostpath/hostpath.go#L592-L610)
Click here to show the 19 line(s) of Go which triggered the analyzer.
```go
for k, v := range mapCopy {
klog.V(4).Infof("loadVolMapFromDisk looking at volume %s hpv %#v", k, v)
pod, err := client.GetPod(v.PodNamespace, v.PodName)
if err != nil {
klog.V(2).Infof("loadVolMapFromDisk could not find pod %s:%s so dropping: %s",
v.PodNamespace, v.PodName, err.Error())
continue
}
if string(pod.UID) != v.PodUID {
klog.V(2).Infof("loadVolMapFromDisk found pod %s:%s but UIDs do no match so dropping: %s vs %s",
v.PodNamespace, v.PodName, string(pod.UID), v.PodUID)
continue
}
hostPathVolumes[k] = &v
err = hp.mapVolumeToPod(&v)
if err != nil {
klog.Warningf("loadVolMapFromDisk error mapping volume %s to shares: %s", k, err.Error())
}
}
```
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: dc73b78c4a27f357ae274864971adbeee2b0e900
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.