summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/extract-ikconfig5
-rw-r--r--scripts/kallsyms.c12
2 files changed, 14 insertions, 3 deletions
diff --git a/scripts/extract-ikconfig b/scripts/extract-ikconfig
index d9f9f34..8187e6f 100755
--- a/scripts/extract-ikconfig
+++ b/scripts/extract-ikconfig
@@ -4,6 +4,7 @@
# $arg1 is [b]zImage filename
binoffset="./scripts/binoffset"
+test -e $binoffset || cc -o $binoffset ./scripts/binoffset.c || exit 1
IKCFG_ST="0x49 0x4b 0x43 0x46 0x47 0x5f 0x53 0x54"
IKCFG_ED="0x49 0x4b 0x43 0x46 0x47 0x5f 0x45 0x44"
@@ -20,7 +21,7 @@ function dump_config {
let start="$start + 8"
let size="$end - $start"
- head --bytes="$end" "$file" | tail --bytes="$size" | zcat
+ dd if="$file" ibs=1 skip="$start" count="$size" 2>/dev/null | zcat
clean_up
exit 0
@@ -45,7 +46,7 @@ then
exit 1
fi
-TMPFILE="/tmp/ikconfig-$$"
+TMPFILE=`mktemp -t ikconfig-XXXXXX` || exit 1
image="$1"
# vmlinux: Attempt to dump the configuration from the file directly
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index d591578..22d281c 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -124,6 +124,11 @@ static int read_symbol(FILE *in, struct sym_entry *s)
* compressed together */
s->len = strlen(str) + 1;
s->sym = malloc(s->len + 1);
+ if (!s->sym) {
+ fprintf(stderr, "kallsyms failure: "
+ "unable to allocate required amount of memory\n");
+ exit(EXIT_FAILURE);
+ }
strcpy((char *)s->sym + 1, str);
s->sym[0] = stype;
@@ -272,7 +277,12 @@ static void write_src(void)
/* table of offset markers, that give the offset in the compressed stream
* every 256 symbols */
- markers = (unsigned int *) malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
+ markers = malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256));
+ if (!markers) {
+ fprintf(stderr, "kallsyms failure: "
+ "unable to allocate required memory\n");
+ exit(EXIT_FAILURE);
+ }
output_label("kallsyms_names");
off = 0;
OpenPOWER on IntegriCloud