All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] module: fix build when DEBUGP is defined
@ 2011-01-12  1:21 Randy Dunlap
  2011-01-12  8:48 ` Rusty Russell
  0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2011-01-12  1:21 UTC (permalink / raw)
  To: lkml; +Cc: akpm, Rusty Russell

From: Randy Dunlap <randy.dunlap@oracle.com>

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 <randy.dunlap@oracle.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
---
 kernel/module.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-next-20110111.orig/kernel/module.c
+++ linux-next-20110111/kernel/module.c
@@ -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
 			memcpy(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);
 	}
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] module: fix build when DEBUGP is defined
  2011-01-12  1:21 [PATCH] module: fix build when DEBUGP is defined Randy Dunlap
@ 2011-01-12  8:48 ` Rusty Russell
  2011-01-12 16:26   ` Randy Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Rusty Russell @ 2011-01-12  8:48 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: lkml, akpm

On Wed, 12 Jan 2011 11:51:53 am Randy Dunlap wrote:
> From: Randy Dunlap <randy.dunlap@oracle.com>
> 
> 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 <randy.dunlap@oracle.com>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> ---
>  kernel/module.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- linux-next-20110111.orig/kernel/module.c
> +++ linux-next-20110111/kernel/module.c
> @@ -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
>  			memcpy(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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] module: fix build when DEBUGP is defined
  2011-01-12  8:48 ` Rusty Russell
@ 2011-01-12 16:26   ` Randy Dunlap
  2011-01-12 22:02     ` Rusty Russell
  0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2011-01-12 16:26 UTC (permalink / raw)
  To: Rusty Russell; +Cc: lkml, akpm

On 01/12/11 00:48, Rusty Russell wrote:
> On Wed, 12 Jan 2011 11:51:53 am Randy Dunlap wrote:
>> From: Randy Dunlap <randy.dunlap@oracle.com>
>>
>> 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 <randy.dunlap@oracle.com>
>> Cc: Rusty Russell <rusty@rustcorp.com.au>
>> ---
>>  kernel/module.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> --- linux-next-20110111.orig/kernel/module.c
>> +++ linux-next-20110111/kernel/module.c
>> @@ -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
>>  			memcpy(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).

-- 
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] module: fix build when DEBUGP is defined
  2011-01-12 16:26   ` Randy Dunlap
@ 2011-01-12 22:02     ` Rusty Russell
  2011-01-13  0:12       ` [PATCH v2] " Randy Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Rusty Russell @ 2011-01-12 22:02 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: lkml, akpm

On Thu, 13 Jan 2011 02:56:17 am Randy Dunlap wrote:
> On 01/12/11 00:48, Rusty Russell wrote:
> > On Wed, 12 Jan 2011 11:51:53 am Randy Dunlap wrote:
> >> From: Randy Dunlap <randy.dunlap@oracle.com>
> >>
> >> 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 <randy.dunlap@oracle.com>
> >> Cc: Rusty Russell <rusty@rustcorp.com.au>
> >> ---
> >>  kernel/module.c |    4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> --- linux-next-20110111.orig/kernel/module.c
> >> +++ linux-next-20110111/kernel/module.c
> >> @@ -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
> >>  			memcpy(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).

shdr->sh_addr is 32 bit, not a long long.  You should get a warning.

Rusty.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] module: fix build when DEBUGP is defined
  2011-01-12 22:02     ` Rusty Russell
@ 2011-01-13  0:12       ` Randy Dunlap
  0 siblings, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2011-01-13  0:12 UTC (permalink / raw)
  To: Rusty Russell; +Cc: lkml, akpm

From: Randy Dunlap <randy.dunlap@oracle.com>

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'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
---
 kernel/module.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- linux-next-20110111.orig/kernel/module.c
+++ linux-next-20110111/kernel/module.c
@@ -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;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-13  0:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-12  1:21 [PATCH] module: fix build when DEBUGP is defined Randy Dunlap
2011-01-12  8:48 ` Rusty Russell
2011-01-12 16:26   ` Randy Dunlap
2011-01-12 22:02     ` Rusty Russell
2011-01-13  0:12       ` [PATCH v2] " Randy Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.