From 6b06cb80be64fcf207bee734cc678c25434ed1a4 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 15 May 2008 21:30:45 +0000 Subject: more of -Wall fixes from Cristian Ionescu-Idbohrn. Some are fixing real bugs. function old new delta syslogd_main 938 958 +20 get_signum 136 143 +7 obj_load 777 782 +5 recv_from_to 210 214 +4 get_next_block 1795 1799 +4 display_topmem_process_list 1117 1121 +4 logread_main 484 487 +3 buffer_fill_and_print 73 76 +3 kill_main 687 689 +2 ll_remember_index 240 241 +1 do_stats 452 453 +1 if_readconf 166 165 -1 display_process_list 1192 1191 -1 run_applet_and_exit 507 505 -2 print_signames 33 31 -2 parse_one_line 1092 1090 -2 find_out_spec 57 55 -2 add_ksymoops_symbols 421 419 -2 ash_main 1407 1402 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17) Total: 37 bytes --- modutils/insmod.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'modutils') diff --git a/modutils/insmod.c b/modutils/insmod.c index f6dcbe8a8..0a74ba0e5 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -2041,7 +2041,7 @@ obj_add_symbol(struct obj_file *f, const char *name, int n_type = ELF_ST_TYPE(info); int n_binding = ELF_ST_BIND(info); - for (sym = f->symtab[hash]; sym; sym = sym->next) + for (sym = f->symtab[hash]; sym; sym = sym->next) { if (f->symbol_cmp(sym->name, name) == 0) { int o_secidx = sym->secidx; int o_info = sym->info; @@ -2100,14 +2100,14 @@ obj_add_symbol(struct obj_file *f, const char *name, return sym; } } + } /* Completely new symbol. */ sym = arch_new_symbol(); sym->next = f->symtab[hash]; f->symtab[hash] = sym; sym->ksymidx = -1; - - if (ELF_ST_BIND(info) == STB_LOCAL && symidx != -1) { + if (ELF_ST_BIND(info) == STB_LOCAL && symidx != (unsigned long)(-1)) { if (symidx >= f->local_symtab_size) bb_error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld", name, (long) symidx, (long) f->local_symtab_size); @@ -3313,7 +3313,7 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits ATTRIBUTE_UNUSED) { struct obj_file *f; ElfW(Shdr) * section_headers; - int shnum, i; + size_t shnum, i; char *shstrtab; /* Read the file header. */ @@ -3585,7 +3585,7 @@ static int obj_gpl_license(struct obj_file *f, const char **license) while (ptr < endptr) { value = strchr(ptr, '='); if (value && strncmp(ptr, "license", value-ptr) == 0) { - int i; + unsigned i; if (license) *license = value+1; for (i = 0; i < ARRAY_SIZE(gpl_licenses); ++i) { @@ -3724,7 +3724,8 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename, struct obj_symbol *sym; char *name, *absolute_filename; char str[STRVERSIONLEN]; - int i, l, lm_name, lfilename, use_ksymtab, version; + unsigned i; + int l, lm_name, lfilename, use_ksymtab, version; struct stat statbuf; /* WARNING: was using realpath, but replaced by readlink to stop using @@ -4127,7 +4128,7 @@ int insmod_main(int argc, char **argv) m_size = obj_load_size(f); m_addr = create_module(m_name, m_size); - if (m_addr == -1) switch (errno) { + if (m_addr == (ElfW(Addr))(-1)) switch (errno) { case EEXIST: bb_error_msg_and_die("a module named %s already exists", m_name); case ENOMEM: -- cgit v1.2.1