aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorJoseph Richey <joerichey@google.com>2022-04-09 01:44:51 -0700
committerGitHub <noreply@github.com>2022-04-09 01:44:51 -0700
commit53dc5f37339f40e78cd0e91b358322cc9e589185 (patch)
tree68eb53440456ff6cc9c6ecef8b0567510de5310a /actions
parentce8a5583c1cc2327cf65a048cfd1083225dad50e (diff)
parentba0a96b04b08f8c8b533d7dab7e6326c5ecd6ace (diff)
Merge pull request #354 from google/staticcheck-fix
Upgrade dependencies to latest version
Diffstat (limited to 'actions')
-rw-r--r--actions/config.go5
-rw-r--r--actions/policy.go2
-rw-r--r--actions/recovery.go6
3 files changed, 8 insertions, 5 deletions
diff --git a/actions/config.go b/actions/config.go
index a8eb029..03d6b04 100644
--- a/actions/config.go
+++ b/actions/config.go
@@ -29,6 +29,7 @@ import (
"time"
"golang.org/x/sys/unix"
+ "google.golang.org/protobuf/proto"
"github.com/google/fscrypt/crypto"
"github.com/google/fscrypt/filesystem"
@@ -210,7 +211,7 @@ func getHashingCosts(target time.Duration) (*metadata.HashingCosts, error) {
memoryKiBLimit := memoryBytesLimit() / 1024
for {
// Store a copy of the previous costs
- costsPrev := *costs
+ costsPrev := proto.Clone(costs).(*metadata.HashingCosts)
tPrev := t
// Double the memory up to the max, then double the time.
@@ -223,7 +224,7 @@ func getHashingCosts(target time.Duration) (*metadata.HashingCosts, error) {
// If our hashing failed, return the last good set of costs.
if t, err = timeHashingCosts(costs); err != nil {
log.Printf("Hashing with costs={%v} failed: %v\n", costs, err)
- return &costsPrev, nil
+ return costsPrev, nil
}
log.Printf("Costs={%v}\t-> %v\n", costs, t)
diff --git a/actions/policy.go b/actions/policy.go
index 3b20176..c621725 100644
--- a/actions/policy.go
+++ b/actions/policy.go
@@ -25,8 +25,8 @@ import (
"os"
"os/user"
- "github.com/golang/protobuf/proto"
"github.com/pkg/errors"
+ "google.golang.org/protobuf/proto"
"github.com/google/fscrypt/crypto"
"github.com/google/fscrypt/filesystem"
diff --git a/actions/recovery.go b/actions/recovery.go
index 8a769cc..2bb8a23 100644
--- a/actions/recovery.go
+++ b/actions/recovery.go
@@ -23,6 +23,8 @@ import (
"os"
"strconv"
+ "google.golang.org/protobuf/proto"
+
"github.com/google/fscrypt/crypto"
"github.com/google/fscrypt/metadata"
"github.com/google/fscrypt/util"
@@ -31,10 +33,10 @@ import (
// modifiedContextWithSource returns a copy of ctx with the protector source
// replaced by source.
func modifiedContextWithSource(ctx *Context, source metadata.SourceType) *Context {
- modifiedConfig := *ctx.Config
+ modifiedConfig := proto.Clone(ctx.Config).(*metadata.Config)
modifiedConfig.Source = source
modifiedCtx := *ctx
- modifiedCtx.Config = &modifiedConfig
+ modifiedCtx.Config = modifiedConfig
return &modifiedCtx
}