summaryrefslogtreecommitdiffstats
path: root/src/barebox-state/backend_storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/barebox-state/backend_storage.c')
-rw-r--r--src/barebox-state/backend_storage.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/barebox-state/backend_storage.c b/src/barebox-state/backend_storage.c
index c6a3e44..ef40a8f 100644
--- a/src/barebox-state/backend_storage.c
+++ b/src/barebox-state/backend_storage.c
@@ -112,15 +112,18 @@ int state_storage_read(struct state_backend_storage *storage,
int ret;
list_for_each_entry(bucket, &storage->buckets, bucket_list) {
- *len = 0;
-
ret = bucket->read(bucket, buf, len);
if (ret) {
dev_warn(storage->dev, "Failed to read from state backend bucket, trying next, %d\n",
ret);
continue;
}
- ret = format->verify(format, magic, *buf, *len);
+
+ /*
+ * Verify the buffer crcs. The buffer length is passed in the len argument,
+ * .verify overwrites it with the length actually used.
+ */
+ ret = format->verify(format, magic, *buf, len);
if (!ret) {
goto found;
}