diff options
Diffstat (limited to 'modutils/insmod.c')
-rw-r--r-- | modutils/insmod.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index d928be27d..df6bf10a0 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -2201,7 +2201,7 @@ static struct obj_section *obj_create_alloced_section(struct obj_file *f, | |||
2201 | int newidx = f->header.e_shnum++; | 2201 | int newidx = f->header.e_shnum++; |
2202 | struct obj_section *sec; | 2202 | struct obj_section *sec; |
2203 | 2203 | ||
2204 | f->sections = xrealloc(f->sections, (newidx + 1) * sizeof(sec)); | 2204 | f->sections = xrealloc_vector(f->sections, 2, newidx); |
2205 | f->sections[newidx] = sec = arch_new_section(); | 2205 | f->sections[newidx] = sec = arch_new_section(); |
2206 | 2206 | ||
2207 | sec->header.sh_type = SHT_PROGBITS; | 2207 | sec->header.sh_type = SHT_PROGBITS; |
@@ -2250,7 +2250,8 @@ static void *obj_extend_section(struct obj_section *sec, unsigned long more) | |||
2250 | { | 2250 | { |
2251 | unsigned long oldsize = sec->header.sh_size; | 2251 | unsigned long oldsize = sec->header.sh_size; |
2252 | if (more) { | 2252 | if (more) { |
2253 | sec->contents = xrealloc(sec->contents, sec->header.sh_size += more); | 2253 | sec->header.sh_size += more; |
2254 | sec->contents = xrealloc(sec->contents, sec->header.sh_size); | ||
2254 | } | 2255 | } |
2255 | return sec->contents + oldsize; | 2256 | return sec->contents + oldsize; |
2256 | } | 2257 | } |
@@ -2736,7 +2737,8 @@ static void new_get_kernel_symbols(void) | |||
2736 | retry_kern_sym_load: | 2737 | retry_kern_sym_load: |
2737 | if (query_module(NULL, QM_SYMBOLS, syms, bufsize, &ret)) { | 2738 | if (query_module(NULL, QM_SYMBOLS, syms, bufsize, &ret)) { |
2738 | if (errno == ENOSPC && bufsize < ret) { | 2739 | if (errno == ENOSPC && bufsize < ret) { |
2739 | syms = xrealloc(syms, bufsize = ret); | 2740 | bufsize = ret; |
2741 | syms = xrealloc(syms, bufsize); | ||
2740 | goto retry_kern_sym_load; | 2742 | goto retry_kern_sym_load; |
2741 | } | 2743 | } |
2742 | bb_perror_msg_and_die("kernel: QM_SYMBOLS"); | 2744 | bb_perror_msg_and_die("kernel: QM_SYMBOLS"); |
@@ -3080,7 +3082,7 @@ static void obj_allocate_commons(struct obj_file *f) | |||
3080 | if (i == f->header.e_shnum) { | 3082 | if (i == f->header.e_shnum) { |
3081 | struct obj_section *sec; | 3083 | struct obj_section *sec; |
3082 | 3084 | ||
3083 | f->sections = xrealloc(f->sections, (i + 1) * sizeof(sec)); | 3085 | f->sections = xrealloc(f->sections, 2, i); |
3084 | f->sections[i] = sec = arch_new_section(); | 3086 | f->sections[i] = sec = arch_new_section(); |
3085 | f->header.e_shnum = i + 1; | 3087 | f->header.e_shnum = i + 1; |
3086 | 3088 | ||