|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 57cd09acf2c63a414aa2131c00a2b3f600eb0133 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Sat, 23 Aug 2014 22:35:03 -0400
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] sd-journal: properly convert object->size on big endian
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
mmap code crashes when attempting to map an object of zero size.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758392
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
https://bugs.freedesktop.org/show_bug.cgi?id=82894
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/journal/journal-file.h | 7 ++++---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 3d416820b0..da2ef3b795 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/src/journal/journal-file.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/journal/journal-file.h
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -214,14 +214,15 @@ static unsigned type_to_context(int type) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static inline int journal_file_object_keep(JournalFile *f, Object *o, uint64_t offset) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned context = type_to_context(o->object.type);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ uint64_t s = le64toh(o->object.size);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
return mmap_cache_get(f->mmap, f->fd, f->prot, context, true,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- offset, o->object.size, &f->last_stat, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ offset, s, &f->last_stat, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
static inline int journal_file_object_release(JournalFile *f, Object *o, uint64_t offset) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
unsigned context = type_to_context(o->object.type);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ uint64_t s = le64toh(o->object.size);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- return mmap_cache_release(f->mmap, f->fd, f->prot, context,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- offset, o->object.size);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return mmap_cache_release(f->mmap, f->fd, f->prot, context, offset, s);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
}
|