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

mzzgaopeng/kubernetes: staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss_cache.go; 10 LoC

Open
#11,661 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 [mzzgaopeng/kubernetes](https://www.github.com/mzzgaopeng/kubernetes) at [staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss_cache.go](https://github.com/mzzgaopeng/kubernetes/blob/ded624b8c7918766a08023e72fa7af79e16be080/staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss_cache.go#L76-L85)

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

[Click here to see the code in its original context.](https://github.com/mzzgaopeng/kubernetes/blob/ded624b8c7918766a08023e72fa7af79e16be080/staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss_cache.go#L76-L85)

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

```go
for _, scaleSet := range allScaleSets {
if scaleSet.Name == nil || *scaleSet.Name == "" {
klog.Warning("failed to get the name of VMSS")
continue
}
localCache.Store(*scaleSet.Name, &vmssEntry{
vmss: &scaleSet,
lastUpdate: time.Now().UTC(),
})
}

```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Read staging/src/k8s.io/legacy-cloud-providers/azure/azure_vmss_cache.go around lines 76-85 and review Go range-loop pointer behavior. Confirm whether the cache entry stores the intended VMSS value, then classify the finding as Bug, Mitigated, or Desirable Behavior; the issue is done when that classification is supported by the code.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, go, kubernetes
Domain
backend, cloud, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.