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