github-vet / github-vet/rangeloop-pointer-findings

konveyor/mig-controller: pkg/controller/discovery/container/velero.go; 9 LoC

Open
#16,446 0 comments 0 reactions 0 assignees View on GitHub
fresh tiny
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [konveyor/mig-controller](https://www.github.com/konveyor/mig-controller) at [pkg/controller/discovery/container/velero.go](https://github.com/konveyor/mig-controller/blob/cf705e01f0dac48c3a557d61d98776b54b6c3420/pkg/controller/discovery/container/velero.go#L502-L510)

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 508 passes reference to discovered to third-party code

[Click here to see the code in its original context.](https://github.com/konveyor/mig-controller/blob/cf705e01f0dac48c3a557d61d98776b54b6c3420/pkg/controller/discovery/container/velero.go#L502-L510)

Click here to show the 9 line(s) of Go which triggered the analyzer.

```go
for _, discovered := range onCluster.Items {
restore := &model.PodVolumeRestore{
Base: model.Base{
Cluster: r.ds.Cluster.PK,
},
}
restore.With(&discovered)
models = append(models, restore)
}

```

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 {
"(With, 1)" -> {"(EncodeObject, 1)";}
"(EncodeObject, 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: cf705e01f0dac48c3a557d61d98776b54b6c3420

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with pkg/controller/discovery/container/velero.go at lines 502-510 and review the use of discovered, including the With call. Check the analyzer context and the linked range-loop finding descriptions, then classify the instance as Bug, Mitigated, or Desirable Behavior by leaving the corresponding reaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.