G601: Implicit memory aliasing in for loop

daemon/cluster/executor/container/adapter.go:446:42: G601: Implicit memory aliasing in for loop. (gosec)
            req := c.container.volumeCreateRequest(&mount)
                                                   ^
    daemon/network.go:577:10: G601: Implicit memory aliasing in for loop. (gosec)
                np := &n
                      ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b4c0c7c076)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-04-16 18:06:43 +02:00
parent e8b838e99f
commit b6de0ca7c5
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 4 additions and 3 deletions

View File

@ -431,6 +431,7 @@ func (c *containerAdapter) remove(ctx context.Context) error {
func (c *containerAdapter) createVolumes(ctx context.Context) error { func (c *containerAdapter) createVolumes(ctx context.Context) error {
// Create plugin volumes that are embedded inside a Mount // Create plugin volumes that are embedded inside a Mount
for _, mount := range c.container.task.Spec.GetContainer().Mounts { for _, mount := range c.container.task.Spec.GetContainer().Mounts {
mount := mount
if mount.Type != api.MountTypeVolume { if mount.Type != api.MountTypeVolume {
continue continue
} }

View File

@ -573,9 +573,9 @@ func (daemon *Daemon) GetNetworks(filter filters.Args, config types.NetworkListC
} }
if config.Detailed { if config.Detailed {
for i, n := range list { for i := range list {
np := &n np := &list[i]
buildDetailedNetworkResources(np, idx[n.ID], config.Verbose) buildDetailedNetworkResources(np, idx[np.ID], config.Verbose)
list[i] = *np list[i] = *np
} }
} }