Commit 55eec70c authored by Hans de Goede's avatar Hans de Goede
Browse files

script_extractor: Remove unnecessary size argument



The script_extractor tool before this commit used to take a size argument
on the cmdline, but the passed in size was only used in some places not
in others. Leading to a segfault if the passed in argument was not
exactly the same as SCRIPT_SIZE.

This commit drops the argument, so that script_extractor will just
work.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 2d258a30
...@@ -21,26 +21,21 @@ ...@@ -21,26 +21,21 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h>
#define SCRIPT_START 0x43000000 #define SCRIPT_START 0x43000000
#define SCRIPT_SIZE 0x20000 #define SCRIPT_SIZE 0x20000
int main(int argc, char *argv[]) { int main(void) {
char *addr; char *addr;
int fd; int fd;
int i; int i;
int size;
fd = open("/dev/mem", O_RDONLY); fd = open("/dev/mem", O_RDONLY);
addr = (char *)mmap(NULL, SCRIPT_SIZE, PROT_READ, MAP_SHARED, fd, SCRIPT_START);
size = SCRIPT_SIZE;
if (argc)
size = atoi(argv[1]);
addr = (char *)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, SCRIPT_START);
for (i = 0; i < SCRIPT_SIZE; i++) for (i = 0; i < SCRIPT_SIZE; i++)
putchar(addr[i]); putchar(addr[i]);
munmap(NULL, SCRIPT_SIZE); munmap(addr, SCRIPT_SIZE);
close(fd); close(fd);
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment