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

lagopus/vsw: agents/tunnel/ipsec/sad/sad_mgr.go; 30 LoC

Open
#18,198 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 [lagopus/vsw](https://www.github.com/lagopus/vsw) at [agents/tunnel/ipsec/sad/sad_mgr.go](https://github.com/lagopus/vsw/blob/d4d17507bd5b52eacf93b8b8002cbc8d6cc0045d/agents/tunnel/ipsec/sad/sad_mgr.go#L447-L476)

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.

>

[Click here to see the code in its original context.](https://github.com/lagopus/vsw/blob/d4d17507bd5b52eacf93b8b8002cbc8d6cc0045d/agents/tunnel/ipsec/sad/sad_mgr.go#L447-L476)

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

```go
for spi, sav := range vrf.sad {
if sav.isSoftExpired(now) {
cntSoft++
if SadbExpire(vrfIndex, mgr.dir, spi, &sav, SoftLifetimeExpired) { // send SADB_EXPIRE(Soft)
_, e := vrf.sad.softExpired(spi)
if e == nil {
log.Logger.Info("softExpired SA-%v: %s", mgr.dir, vrf.sad.logStringChanged(spi, sav.inStat))
} else {
log.Logger.Err("ERR: Failed post-softExpired op: %s", e)
// TBD error handle
}
} else {
err = fmt.Errorf("Failed to send SADB_EXPIRE(soft): spi=%d", spi)
}
}
if sav.isHardExpired(now) {
cntHard++
if SadbExpire(vrfIndex, mgr.dir, spi, &sav, HardLifetimeExpired) { // send SADB_EXPIRE(Hard)
_, e := vrf.sad.hardExpired(spi)
if e == nil {
log.Logger.Info("hardExpired SA-%v: %s", mgr.dir, vrf.sad.logStringChanged(spi, sav.inStat))
} else {
log.Logger.Err("ERR: Failed post-hardExpired op: %s", e)
// TBD error handle
}
} else {
err = fmt.Errorf("Failed to send SADB_EXPIRE(hard): spi=%d", spi)
}
}
}

```

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.

No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.

root signature {SadbExpire 5} was not found in the callgraph; reference was passed directly to third-party code
```

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: d4d17507bd5b52eacf93b8b8002cbc8d6cc0045d

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.