[syslinux:elflink] module: Fixed the upper limit in symbol table walk through

syslinux-bot for Chandramouli Narayanan chandramouli.narayanan at intel.com
Wed Sep 5 08:36:08 PDT 2012


Commit-ID:  a40bb65a4d1351c7c2b414152186f63aa5ea2a07
Gitweb:     http://www.syslinux.org/commit/a40bb65a4d1351c7c2b414152186f63aa5ea2a07
Author:     Chandramouli Narayanan <chandramouli.narayanan at intel.com>
AuthorDate: Wed, 5 Sep 2012 07:49:49 +0100
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Wed, 5 Sep 2012 07:49:49 +0100

module: Fixed the upper limit in symbol table walk through

Number of entries in symbol table should be sized by the table entry
size. Without this, the loading of modules takes forever due to
walking all over the memory.

Signed-off-by: Chandramouli Narayanan <chandramouli.narayanan at intel.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/lib/sys/module/common.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/com32/lib/sys/module/common.c b/com32/lib/sys/module/common.c
index 6e63907..30c57b4 100644
--- a/com32/lib/sys/module/common.c
+++ b/com32/lib/sys/module/common.c
@@ -47,7 +47,7 @@ void print_elf_symbols(struct elf_module *module) {
 	unsigned int i;
 	Elf32_Sym *crt_sym;
 
-	for (i = 1; i < module->symtable_size; i++)
+	for (i = 1; i < module->symtable_size/module->syment_size; i++)
 	{
 		crt_sym = (Elf32_Sym*)(module->sym_table + i*module->syment_size);
 
@@ -315,7 +315,7 @@ int check_symbols(struct elf_module *module)
 	int strong_count;
 	int weak_count;
 
-	for(i = 1; i < module->symtable_size; i++)
+	for (i = 1; i < module->symtable_size/module->syment_size; i++)
 	{
 		crt_sym = symbol_get_entry(module, i);
 		crt_name = module->str_table + crt_sym->st_name;
@@ -535,7 +535,7 @@ static Elf32_Sym *module_find_symbol_iterate(const char *name,struct elf_module
 	unsigned int i;
 	Elf32_Sym *crt_sym;
 
-	for (i=1; i < module->symtable_size; i++)
+	for (i = 1; i < module->symtable_size/module->syment_size; i++)
 	{
 		crt_sym = symbol_get_entry(module, i);
 		if (strcmp(name, module->str_table + crt_sym->st_name) == 0)


More information about the Syslinux-commits mailing list