On Fri, Oct 23, 2015 at 11:10:00AM +0800, Dave Young wrote: > 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 at redhat.com> Thanks, applied. > --- > kexec/kexec.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > --- kexec-tools.orig/kexec/kexec.c > +++ kexec-tools/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, o > 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); > >