github-vet / github-vet/rangeloop-pointer-findings
minio/direct-csi: cmd/kubectl-direct_csi/remove-drives.go; 9 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [minio/direct-csi](https://www.github.com/minio/direct-csi) at [cmd/kubectl-direct_csi/remove-drives.go](https://github.com/minio/direct-csi/blob/e70429038f0a271db7f64467407e39b06ca93a6c/cmd/kubectl-direct_csi/remove-drives.go#L90-L98)
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 at line 95 passes reference to drive to third-party code
[Click here to see the code in its original context.](https://github.com/minio/direct-csi/blob/e70429038f0a271db7f64467407e39b06ca93a6c/cmd/kubectl-direct_csi/remove-drives.go#L90-L98)
Click here to show the 9 line(s) of Go which triggered the analyzer.
```go
for _, drive := range drives.Items {
if nodeSet.Contains(drive.Status.NodeName) {
match, _ := regexp.Match(args[0], []byte(drive.Status.Path))
if match {
drive.Spec.DirectCSIOwned = false
directCSIClient.DirectCSIDrives().Update(ctx, &drive, metav1.UpdateOptions{})
}
}
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
The following graphviz dot graph describes paths through the callgraph that could lead to a function which passes a pointer to third-party code:
digraph G {
"(Update, 3)" -> {}
}
```
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: e70429038f0a271db7f64467407e39b06ca93a6c
Contributor guide
No contributing guide indexed for this repository
Research direction
Read cmd/kubectl-direct_csi/remove-drives.go around lines 90-98 and inspect the linked commit context. Review how the range variable is passed to Update, then classify the finding as Bug, Mitigated, or Desirable Behavior using the project's stated reaction options; no patch or test is named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100