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

cloudfoundry/bosh-softlayer-cpi-release: src/bosh-softlayer-cpi/softlayer/virtual_guest_service/softlayer_ubuntu_net_manager.go; 19 LoC

Open
#17,743 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [cloudfoundry/bosh-softlayer-cpi-release](https://www.github.com/cloudfoundry/bosh-softlayer-cpi-release) at [src/bosh-softlayer-cpi/softlayer/virtual_guest_service/softlayer_ubuntu_net_manager.go](https://github.com/cloudfoundry/bosh-softlayer-cpi-release/blob/2ac3827fc19f630a64b2630408754a79003aaa89/src/bosh-softlayer-cpi/softlayer/virtual_guest_service/softlayer_ubuntu_net_manager.go#L88-L106)

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 nw is reassigned at line 97

[Click here to see the code in its original context.](https://github.com/cloudfoundry/bosh-softlayer-cpi-release/blob/2ac3827fc19f630a64b2630408754a79003aaa89/src/bosh-softlayer-cpi/softlayer/virtual_guest_service/softlayer_ubuntu_net_manager.go#L88-L106)

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

```go
for _, nw := range networks {
if nw.Type != "dynamic" {
continue
}

if networkComponents.PrimaryBackendNetworkComponent.NetworkVlan != nil && nw.CloudProperties.VlanID == *(networkComponents.PrimaryBackendNetworkComponent.NetworkVlan.Id) {
if privateDynamic != nil {
return nil, errors.New("multiple private dynamic networks are not supported")
}
privateDynamic = &nw // #nosec G601
}

if networkComponents.PrimaryNetworkComponent.NetworkVlan != nil && nw.CloudProperties.VlanID == *(networkComponents.PrimaryNetworkComponent.NetworkVlan.Id) {
if publicDynamic != nil {
return nil, errors.New("multiple public dynamic networks are not supported")
}
publicDynamic = &nw // #nosec G601
}
}

```

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: 2ac3827fc19f630a64b2630408754a79003aaa89

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.