github-vet / github-vet/rangeloop-pointer-findings
pacslab/DockerMV: go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/scheduler/nodeset.go; 65 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [pacslab/DockerMV](https://www.github.com/pacslab/DockerMV) at [go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/scheduler/nodeset.go](https://github.com/pacslab/DockerMV/blob/06c03df00b59a415804baa8746aa1690d0e52f5b/go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/scheduler/nodeset.go#L57-L121)
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/pacslab/DockerMV/blob/06c03df00b59a415804baa8746aa1690d0e52f5b/go/src/github.com/docker/docker/vendor/github.com/docker/swarmkit/manager/scheduler/nodeset.go#L57-L121)
Click here to show the 65 line(s) of Go which triggered the analyzer.
```go
for _, node := range ns.nodes {
tree := &root
for _, pref := range preferences {
// Only spread is supported so far
spread := pref.GetSpread()
if spread == nil {
continue
}
descriptor := spread.SpreadDescriptor
var value string
switch {
case len(descriptor) > len(constraint.NodeLabelPrefix) && strings.EqualFold(descriptor[:len(constraint.NodeLabelPrefix)], constraint.NodeLabelPrefix):
if node.Spec.Annotations.Labels != nil {
value = node.Spec.Annotations.Labels[descriptor[len(constraint.NodeLabelPrefix):]]
}
case len(descriptor) > len(constraint.EngineLabelPrefix) && strings.EqualFold(descriptor[:len(constraint.EngineLabelPrefix)], constraint.EngineLabelPrefix):
if node.Description != nil && node.Description.Engine != nil && node.Description.Engine.Labels != nil {
value = node.Description.Engine.Labels[descriptor[len(constraint.EngineLabelPrefix):]]
}
// TODO(aaronl): Support other items from constraint
// syntax like node ID, hostname, os/arch, etc?
default:
continue
}
// If value is still uninitialized, the value used for
// the node at this level of the tree is "". This makes
// sure that the tree structure is not affected by
// which properties nodes have and don't have.
if node.ActiveTasksCountByService != nil {
tree.tasks += node.ActiveTasksCountByService[serviceID]
}
if tree.next == nil {
tree.next = make(map[string]*decisionTree)
}
next := tree.next[value]
if next == nil {
next = &decisionTree{}
tree.next[value] = next
}
tree = next
}
if node.ActiveTasksCountByService != nil {
tree.tasks += node.ActiveTasksCountByService[serviceID]
}
if tree.nodeHeap.lessFunc == nil {
tree.nodeHeap.lessFunc = nodeLess
}
if tree.nodeHeap.Len() < maxAssignments {
if meetsConstraints(&node) {
heap.Push(&tree.nodeHeap, node)
}
} else if nodeLess(&node, &tree.nodeHeap.nodes[0]) {
if meetsConstraints(&node) {
tree.nodeHeap.nodes[0] = node
heap.Fix(&tree.nodeHeap, 0)
}
}
}
```
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 {meetsConstraints 1} 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: 06c03df00b59a415804baa8746aa1690d0e52f5b
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.