module: fix build when DEBUGP is defined
PATCH 1/1 module: fix build when DEBUGP is defined
From: Randy Dunlap <[email protected]>
Fix module loader build when DEBUGP is defined.
Fixes build error & warning:
kernel/module.c:1910: error: 'name' undeclared (first use in this function) kernel/module.c:2567: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'Elf64_Addr'
--- kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/module.c +2 -2
@@ -1907,7 +1907,7 @@ static void layout_sections(struct modul || strstarts(sname, ".init"))continue ; s->sh_entsize =get_offset (mod, &mod->core_size, s, i); -DEBUGP ("\t%s\n" , name); +DEBUGP ("\t%s\n" , sname); }switch (m) {case 0 :/* executable */
@@ -2563,7 +2563,7 @@ static int move_module(struct module *momemcpy (dest, (void *)shdr->sh_addr, shdr->sh_size);/* Update sh_addr to point to copy in image. */ shdr->sh_addr = (unsigned long )dest; -DEBUGP ("\t0x%lx %s\n" , +DEBUGP ("\t0x%llx %s\n" , shdr->sh_addr, info->secstrings + shdr->sh_name); }
Quoted 26 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Fix module loader build when DEBUGP is defined.
Fixes build error & warning:
kernel/module.c:1910: error: 'name' undeclared (first use in this function)kernel/module.c:2567: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'Elf64_Addr'Signed-off-by Randy Dunlap <[email protected]>Cc Rusty Russell <[email protected]>--- kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/module.c +1
-1@@ -1907,7 +1907,7 @@ static void layout_sections(struct modul || strstarts(sname, ".init"))continue ; s->sh_entsize =get_offset (mod, &mod->core_size, s, i); -DEBUGP ("\t%s\n" , name); +DEBUGP ("\t%s\n" , sname); }switch (m) {case 0 :/* executable */
kernel/module.c static int move_module(struct module *mo · line 2567
Quoted 6 lines
kernel/module.c +1
-1@@ -2563,7 +2563,7 @@ static int move_module(struct module *momemcpy (dest, (void *)shdr->sh_addr, shdr->sh_size);/* Update sh_addr to point to copy in image. */ shdr->sh_addr = (unsigned long )dest; -DEBUGP ("\t0x%lx %s\n" , +DEBUGP ("\t0x%llx %s\n" , shdr->sh_addr, info->secstrings + shdr->sh_name);
This will break on 32-bit. We really need a cast to long here :(
Thanks,
Rusty.
Quoted 27 lines · Rusty Russell
Quoted 26 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Fix module loader build when DEBUGP is defined.
Fixes build error & warning:
kernel/module.c:1910: error: 'name' undeclared (first use in this function)kernel/module.c:2567: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'Elf64_Addr'Signed-off-by Randy Dunlap <[email protected]>Cc Rusty Russell <[email protected]>--- kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/module.c +1
-1@@ -1907,7 +1907,7 @@ static void layout_sections(struct modul || strstarts(sname, ".init"))continue ; s->sh_entsize =get_offset (mod, &mod->core_size, s, i); -DEBUGP ("\t%s\n" , name); +DEBUGP ("\t%s\n" , sname); }switch (m) {case 0 :/* executable */ @@ -2563,7 +2563,7 @@ static int move_module(struct module *mo
Quoted 8 lines
kernel/module.c static int move_module(struct module *mo · line 2567
Quoted 6 lines
kernel/module.c +1
-1memcpy (dest, (void *)shdr->sh_addr, shdr->sh_size);/* Update sh_addr to point to copy in image. */ shdr->sh_addr = (unsigned long )dest; -DEBUGP ("\t0x%lx %s\n" , +DEBUGP ("\t0x%llx %s\n" , shdr->sh_addr, info->secstrings + shdr->sh_name);This will break on 32-bit. We really need a cast to long here :(
Really? I built it on i386 and x86_64 (successfully).
Signature · 2 lines
~Randy *** Remember to use Documentation/SubmitChecklist when testing your code ***
Quoted 37 lines · Randy Dunlap
Quoted 27 lines · Rusty Russell
Quoted 26 lines · Randy Dunlap
From: Randy Dunlap <[email protected]>
Fix module loader build when DEBUGP is defined.
Fixes build error & warning:
kernel/module.c:1910: error: 'name' undeclared (first use in this function)kernel/module.c:2567: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'Elf64_Addr'Signed-off-by Randy Dunlap <[email protected]>Cc Rusty Russell <[email protected]>--- kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/module.c +1
-1@@ -1907,7 +1907,7 @@ static void layout_sections(struct modul || strstarts(sname, ".init"))continue ; s->sh_entsize =get_offset (mod, &mod->core_size, s, i); -DEBUGP ("\t%s\n" , name); +DEBUGP ("\t%s\n" , sname); }switch (m) {case 0 :/* executable */ @@ -2563,7 +2563,7 @@ static int move_module(struct module *moQuoted 8 lines
kernel/module.c static int move_module(struct module *mo · line 2567
Quoted 6 lines
kernel/module.c +1
-1memcpy (dest, (void *)shdr->sh_addr, shdr->sh_size);/* Update sh_addr to point to copy in image. */ shdr->sh_addr = (unsigned long )dest; -DEBUGP ("\t0x%lx %s\n" , +DEBUGP ("\t0x%llx %s\n" , shdr->sh_addr, info->secstrings + shdr->sh_name);This will break on 32-bit. We really need a cast to long here :(
Quoted 1 line
Really? I built it on i386 and
x86_64(successfully).
shdr->sh_addr is 32 bit, not a long long. You should get a warning.
Rusty.
PATCH v2 1/1 module: fix build when DEBUGP is defined
From: Randy Dunlap <[email protected]>
Fix module loader build when DEBUGP is defined.
Fixes build error & warning:
(on x86_64:)kernel/module.c:1910: error: 'name' undeclared (first use in this function) kernel/module.c:2567: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'Elf64_Addr' (or on i386:)kernel/module.c:2567: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'Elf32_Addr'
--- kernel/module.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/module.c +3 -2
@@ -1907,7 +1907,7 @@ static void layout_sections(struct modul || strstarts(sname, ".init"))continue ; s->sh_entsize =get_offset (mod, &mod->core_size, s, i); -DEBUGP ("\t%s\n" , name); +DEBUGP ("\t%s\n" , sname); }switch (m) {case 0 :/* executable */
@@ -2564,7 +2564,8 @@ static int move_module(struct module *mo/* Update sh_addr to point to copy in image. */ shdr->sh_addr = (unsigned long )dest;DEBUGP ("\t0x%lx %s\n" , - shdr->sh_addr, info->secstrings + shdr->sh_name); + (unsigned long )shdr->sh_addr, + info->secstrings + shdr->sh_name); }return 0 ;