public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Fengguang Wu <fengguang.wu@intel.com>
Subject: Re: [PATCH] modules: Fix build error in moduleloader.h
Date: Fri, 04 Jul 2014 09:53:08 +0900	[thread overview]
Message-ID: <53B5FAF4.2050705@hitachi.com> (raw)
In-Reply-To: <20140703092121.082e0366@gandalf.local.home>

(2014/07/03 22:21), Steven Rostedt wrote:
> Fengguang Wu's build bot detected that if moduleloader.h is included in
> a C file (used by ftrace and kprobes to access module_alloc() when
> available), that it can fail to build if CONFIG_MODULES and
> CONFIG_MODULES_USE_ELF_REL is not defined.
> 
> This is because there's a printk() that dereferences struct module to
> print the name of the module. But as struct module does not exist when
> CONFIG_MODULES is not defined we get this error:
> 
>    include/linux/moduleloader.h: In function 'apply_relocate':
>>> include/linux/moduleloader.h:48:63: error: dereferencing pointer to incomplete type  
>      printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
>                                                                   ^
> Avoid the printk if CONFIG_MODULES is not set.

Looks OK to me. BTW, CONFIG_KPROBES depends on CONFIG_MODULES,
so currently kprobes itself doesn't hit that problem.

Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Thank you, :)

> 
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
> diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
> index 560ca53..d9da807 100644
> --- a/include/linux/moduleloader.h
> +++ b/include/linux/moduleloader.h
> @@ -45,7 +45,10 @@ static inline int apply_relocate(Elf_Shdr *sechdrs,
>  				 unsigned int relsec,
>  				 struct module *me)
>  {
> +/* me->name only exists if modules are enabled */
> +#ifdef CONFIG_MODULES
>  	printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
> +#endif
>  	return -ENOEXEC;
>  }
>  #endif
> 


-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



  reply	other threads:[~2014-07-04  0:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-03 13:21 [PATCH] modules: Fix build error in moduleloader.h Steven Rostedt
2014-07-04  0:53 ` Masami Hiramatsu [this message]
2014-07-07 23:40 ` Rusty Russell
2014-07-08  2:51   ` Masami Hiramatsu
2014-07-08 15:08   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53B5FAF4.2050705@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox