|
|
65878a |
From dcf643901f6aeeda806e19fa7cbb766ded3f3d44 Mon Sep 17 00:00:00 2001
|
|
|
65878a |
From: George McCollister <george.mccollister@gmail.com>
|
|
|
65878a |
Date: Tue, 31 Dec 2013 14:37:32 -0600
|
|
|
65878a |
Subject: [PATCH] journal: Add missing byte order conversions
|
|
|
65878a |
|
|
|
65878a |
Convert entry_array.items[0] to host byte order prior to passing it to
|
|
|
65878a |
chain_cache_put().
|
|
|
65878a |
|
|
|
65878a |
[zj: also use le64toh in journal-verify.c]
|
|
|
65878a |
|
|
|
65878a |
https://bugs.freedesktop.org/show_bug.cgi?id=73194
|
|
|
65878a |
---
|
|
|
65878a |
src/journal/journal-file.c | 4 ++--
|
|
|
65878a |
src/journal/journal-verify.c | 6 +++---
|
|
|
65878a |
2 files changed, 5 insertions(+), 5 deletions(-)
|
|
|
65878a |
|
|
|
65878a |
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
|
|
|
65878a |
index 9f04c58..748816a 100644
|
|
|
65878a |
--- a/src/journal/journal-file.c
|
|
|
65878a |
+++ b/src/journal/journal-file.c
|
|
|
65878a |
@@ -1452,7 +1452,7 @@ static int generic_array_get(
|
|
|
65878a |
|
|
|
65878a |
found:
|
|
|
65878a |
/* Let's cache this item for the next invocation */
|
|
|
65878a |
- chain_cache_put(f->chain_cache, ci, first, a, o->entry_array.items[0], t, i);
|
|
|
65878a |
+ chain_cache_put(f->chain_cache, ci, first, a, le64toh(o->entry_array.items[0]), t, i);
|
|
|
65878a |
|
|
|
65878a |
r = journal_file_move_to_object(f, OBJECT_ENTRY, p, &o);
|
|
|
65878a |
if (r < 0)
|
|
|
65878a |
@@ -1685,7 +1685,7 @@ found:
|
|
|
65878a |
return 0;
|
|
|
65878a |
|
|
|
65878a |
/* Let's cache this item for the next invocation */
|
|
|
65878a |
- chain_cache_put(f->chain_cache, ci, first, a, array->entry_array.items[0], t, subtract_one ? (i > 0 ? i-1 : (uint64_t) -1) : i);
|
|
|
65878a |
+ chain_cache_put(f->chain_cache, ci, first, a, le64toh(array->entry_array.items[0]), t, subtract_one ? (i > 0 ? i-1 : (uint64_t) -1) : i);
|
|
|
65878a |
|
|
|
65878a |
if (subtract_one && i == 0)
|
|
|
65878a |
p = last_p;
|
|
|
65878a |
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
|
|
|
65878a |
index 3405811..82b0f0a 100644
|
|
|
65878a |
--- a/src/journal/journal-verify.c
|
|
|
65878a |
+++ b/src/journal/journal-verify.c
|
|
|
65878a |
@@ -249,12 +249,12 @@ static int journal_file_object_verify(JournalFile *f, uint64_t offset, Object *o
|
|
|
65878a |
}
|
|
|
65878a |
|
|
|
65878a |
for (i = 0; i < journal_file_entry_array_n_items(o); i++)
|
|
|
65878a |
- if (o->entry_array.items[i] != 0 &&
|
|
|
65878a |
- !VALID64(o->entry_array.items[i])) {
|
|
|
65878a |
+ if (le64toh(o->entry_array.items[i]) != 0 &&
|
|
|
65878a |
+ !VALID64(le64toh(o->entry_array.items[i]))) {
|
|
|
65878a |
log_error(OFSfmt": invalid object entry array item (%"PRIu64"/%"PRIu64"): "OFSfmt,
|
|
|
65878a |
offset,
|
|
|
65878a |
i, journal_file_entry_array_n_items(o),
|
|
|
65878a |
- o->entry_array.items[i]);
|
|
|
65878a |
+ le64toh(o->entry_array.items[i]));
|
|
|
65878a |
return -EBADMSG;
|
|
|
65878a |
}
|
|
|
65878a |
|