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

drewkerrigan/dcos-cni-plugins: l4lb/l4lb.go; 12 LoC

Open
#17,298 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 [drewkerrigan/dcos-cni-plugins](https://www.github.com/drewkerrigan/dcos-cni-plugins) at [l4lb/l4lb.go](https://github.com/drewkerrigan/dcos-cni-plugins/blob/6f957d04f028c635fd877903aaf0f12ebf681091/l4lb/l4lb.go#L101-L112)

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 spartanIP was used in a composite literal at line 104

[Click here to see the code in its original context.](https://github.com/drewkerrigan/dcos-cni-plugins/blob/6f957d04f028c635fd877903aaf0f12ebf681091/l4lb/l4lb.go#L101-L112)

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

```go
for _, spartanIP := range spartanIPs {
spartanRoute := netlink.Route{
LinkIndex: containerVeth.Attrs().Index,
Dst: &spartanIP,
Scope: netlink.SCOPE_LINK,
Src: pr.IPs[0].Address.IP,
}

if err = netlink.RouteAdd(&spartanRoute); err != nil {
return fmt.Errorf("failed to add spartan route %v: %v", spartanRoute, err)
}
}

```

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: 6f957d04f028c635fd877903aaf0f12ebf681091

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with l4lb/l4lb.go lines 101-112 and inspect how the range variable spartanIP is referenced in the netlink.Route literal. Determine whether the analyzer's finding represents a bug, mitigated behavior, or desirable behavior, then record the appropriate reaction on the issue; no test or patch is named in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.