summaryrefslogtreecommitdiff
path: root/kexec
diff options
context:
space:
mode:
authorDave Young <dyoung@redhat.com>2015-10-23 11:10:00 +0800
committerSimon Horman <horms@verge.net.au>2015-10-26 13:28:58 +0900
commit86866f6f7532604a20708bf90ecb5f2f8b14c227 (patch)
tree55e191fb53b012adbfd850c6c6d09d0f48faf45d /kexec
parentfaef3d02bb0d365a3975c3bca7c948217db36227 (diff)
Revert "kexec: use mmap instead of read for slurp_file()"
This reverts commit 7ab842d8a004f6cd75a9d7b3528e4a70819ce4ef. using mmap by default in slurp_file cause segment fault while later reallocing dtb_buf during my arm kexec test. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec')
-rw-r--r--kexec/kexec.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/kexec/kexec.c b/kexec/kexec.c
index ff024f3..b9f1816 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -26,7 +26,6 @@
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
-#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/reboot.h>
@@ -553,12 +552,11 @@ char *slurp_file(const char *filename, off_t *r_size)
if (err < 0)
die("Can not seek to the begin of file %s: %s\n",
filename, strerror(errno));
- buf = slurp_fd(fd, filename, size, &nread);
} else {
- size = nread = stats.st_size;
- buf = mmap(NULL, size,
- PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
+ size = stats.st_size;
}
+
+ buf = slurp_fd(fd, filename, size, &nread);
if (!buf)
die("Cannot read %s", filename);