1. 11 9月, 2014 1 次提交
    • M
      moduleparam: Resolve missing-field-initializer warning · 184c3fc3
      Mark Rustad 提交于
      Resolve a missing-field-initializer warning, that is produced
      by every reference to module_param_call, by using designated
      initialization for the first field. That is enough to silence
      the complaint.
      
      The message is only seen when doing a W=2 build. I happened to be using gcc
      4.8.3, but I think most versions would produce the warning when it is
      enabled. It can either be silenced by using even a single designated
      initializer as I did here, or providing values for all of the fields. Because
      of the number of references to the macro, this change silences many warnings
      in W=2 builds.
      
      One instance of the full warning message looks like this:
      
      /home/share/git/nn-mdr/include/linux/moduleparam.h:198:16: warning: missing
      initializer for field ‘free’ of ‘struct kernel_param_ops’
      [-Wmissing-field-initializers]
        static struct kernel_param_ops __param_ops_##name =  \
      		  ^
      /home/share/git/nn-mdr/fs/fuse/inode.c:35:1: note: in expansion of macro
      ‘module_param_call’
       module_param_call(max_user_bgreq, set_global_limit, param_get_uint,
       ^
      /home/share/git/nn-mdr/include/linux/moduleparam.h:56:9: note: ‘free’
      declared here
        void (*free)(void *arg);
      Signed-off-by: NMark Rustad <mark.d.rustad@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      184c3fc3
  2. 27 8月, 2014 4 次提交
  3. 18 7月, 2014 1 次提交
  4. 28 4月, 2014 1 次提交
    • R
      param: hand arguments after -- straight to init · 51e158c1
      Rusty Russell 提交于
      The kernel passes any args it doesn't need through to init, except it
      assumes anything containing '.' belongs to the kernel (for a module).
      This change means all users can clearly distinguish which arguments
      are for init.
      
      For example, the kernel uses debug ("dee-bug") to mean log everything to
      the console, where systemd uses the debug from the Scandinavian "day-boog"
      meaning "fail to boot".  If a future versions uses argv[] instead of
      reading /proc/cmdline, this confusion will be avoided.
      
      eg: test 'FOO="this is --foo"' -- 'systemd.debug="true true true"'
      
      Gives:
      argv[0] = '/debug-init'
      argv[1] = 'test'
      argv[2] = 'systemd.debug=true true true'
      envp[0] = 'HOME=/'
      envp[1] = 'TERM=linux'
      envp[2] = 'FOO=this is --foo'
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      51e158c1
  5. 24 3月, 2014 1 次提交
  6. 17 3月, 2014 1 次提交
    • M
      module: LLVMLinux: Remove unused function warning from __param_check macro · 0283f9a5
      Mark Charlebois 提交于
      This code makes a compile time type check that is optimized away. Clang
      complains that it generates an unused function:
      
      linux/kernel/panic.c:471:1: warning: unused function '__check_panic'
            [-Wunused-function]
      core_param(panic, panic_timeout, int, 0644);
      ^
      linux/moduleparam.h:283:2: note: expanded from macro
            'core_param'
              param_check_##type(name, &(var));                               \
              ^
      <scratch space>:87:1: note: expanded from here
      param_check_int
      ^
      linux/moduleparam.h:369:34: note: expanded from macro
            'param_check_int'
      #define param_check_int(name, p) __param_check(name, p, int)
                                       ^
      linux/moduleparam.h:349:22: note: expanded from macro
            '__param_check'
              static inline type *__check_##name(void) { return(p); }
                                  ^
      <scratch space>:88:1: note: expanded from here
      __check_panic
      
      GCC won't complain for a static inline function but would if it was just
      a static function.
      
      Adding the unused attribute to the function declaration removes the warning.
      Per request from Rusty Russell it is marked as __always_unused as the code
      is meant to be optimized away.
      
      This code works for both GCC and clang.
      Signed-off-by: NMark Charlebois <charlebm@gmail.com>
      Signed-off-by: NBehan Webster <behanw@converseincode.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      0283f9a5
  7. 20 8月, 2013 1 次提交
    • S
      module: Add flag to allow mod params to have no arguments · ab013c5f
      Steven Rostedt 提交于
      Currently the params.c code allows only two "set" functions to have
      no arguments. If a parameter does not have an argument, then it
      looks at the set function and tests if it is either param_set_bool()
      or param_set_bint(). If it is not one of these functions, then it
      fails the loading of the module.
      
      But there may be module parameters that have different set functions
      and still allow no arguments. But unless each of these cases adds
      their function to the if statement, it wont be allowed to have no
      arguments. This method gets rather messing and does not scale.
      
      Instead, introduce a flags field to the kernel_param_ops, where if
      the flag KERNEL_PARAM_FL_NOARG is set, the parameter will not fail
      if it does not contain an argument. It will be expected that the
      corresponding set function can handle a NULL pointer as "val".
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      ab013c5f
  8. 02 7月, 2013 1 次提交
  9. 14 12月, 2012 1 次提交
  10. 08 6月, 2012 1 次提交
    • R
      module_param: stop double-calling parameters. · ae82fdb1
      Rusty Russell 提交于
      Commit 026cee00 "params:
      <level>_initcall-like kernel parameters" set old-style module
      parameters to level 0.  And we call those level 0 calls where we used
      to, early in start_kernel().
      
      We also loop through the initcall levels and call the levelled
      module_params before the corresponding initcall.  Unfortunately level
      0 is early_init(), so we call the standard module_param calls twice.
      
      (Turns out most things don't care, but at least ubi.mtd does).
      
      Change the level to -1 for standard module_param calls.
      Reported-by: NBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: stable@kernel.org
      ae82fdb1
  11. 01 5月, 2012 1 次提交
    • J
      params: add 3rd arg to option handler callback signature · 9fb48c74
      Jim Cromie 提交于
      Add a 3rd arg, named "doing", to unknown-options callbacks invoked
      from parse_args(). The arg is passed as:
      
        "Booting kernel" from start_kernel(),
        initcall_level_names[i] from do_initcall_level(),
        mod->name from load_module(), via parse_args(), parse_one()
      
      parse_args() already has the "name" parameter, which is renamed to
      "doing" to better reflect current uses 1,2 above.  parse_args() passes
      it to an altered parse_one(), which now passes it down into the
      unknown option handler callbacks.
      
      The mod->name will be needed to handle dyndbg for loadable modules,
      since params passed by modprobe are not qualified (they do not have a
      "$modname." prefix), and by the time the unknown-param callback is
      called, the module name is not otherwise available.
      
      Minor tweaks:
      
      Add param-name to parse_one's pr_debug(), current message doesnt
      identify the param being handled, add it.
      
      Add a pr_info to print current level and level_name of the initcall,
      and number of registered initcalls at that level.  This adds 7 lines
      to dmesg output, like:
      
         initlevel:6=device, 172 registered initcalls
      
      Drop "parameters" from initcall_level_names[], its unhelpful in the
      pr_info() added above.  This array is passed into parse_args() by
      do_initcall_level().
      
      CC: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NJim Cromie <jim.cromie@gmail.com>
      Acked-by: NJason Baron <jbaron@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fb48c74
  12. 26 3月, 2012 2 次提交
  13. 13 1月, 2012 3 次提交
    • R
      module_param: check that bool parameters really are bool. · 72db395f
      Rusty Russell 提交于
      module_param(bool) used to counter-intuitively take an int.  In
      fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
      trick.
      
      This tightens the check (you'll get a warning about incompatible
      return type) but still allows it.  Next kernel version, we'll remove
      it.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      72db395f
    • R
      module_param: avoid bool abuse, add bint for special cases. · 69116f27
      Rusty Russell 提交于
      For historical reasons, we allow module_param(bool) to take an int (or
      an unsigned int).  That's going away.
      
      A few drivers really want an int: they set it to -1 and a parameter
      will set it to 0 or 1.  This sucks: reading them from sysfs will give
      'Y' for both -1 and 1, but if we change it to an int, then the users
      might be broken (if they did "param" instead of "param=1").
      
      Use a new 'bint' parser for them.
      
      (ntfs has a different problem: it needs an int for debug_msgs because
      it's also exposed via sysctl.)
      
      Cc: Steve Glendinning <steve.glendinning@smsc.com>
      Cc: Jean Delvare <khali@linux-fr.org>
      Cc: Guenter Roeck <guenter.roeck@ericsson.com>
      Cc: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
      Cc: Christoph Raisch <raisch@de.ibm.com>
      Cc: Roland Dreier <roland@kernel.org>
      Cc: Sean Hefty <sean.hefty@intel.com>
      Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
      Cc: linux390@de.ibm.com
      Cc: Anton Altaparmakov <anton@tuxera.com>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: lm-sensors@lm-sensors.org
      Cc: linux-rdma@vger.kernel.org
      Cc: linux-s390@vger.kernel.org
      Cc: linux-ntfs-dev@lists.sourceforge.net
      Cc: alsa-devel@alsa-project.org
      Acked-by: Takashi Iwai <tiwai@suse.de> (For the sound part)
      Acked-by: Guenter Roeck <guenter.roeck@ericsson.com> (For the hwmon driver)
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      69116f27
    • R
      module_param: check type correctness for module_param_array · bafeafea
      Rusty Russell 提交于
      module_param_array(), unlike its non-array cousins, didn't check the type
      of the variable.  Fixing this found two bugs.
      
      Cc: Luca Risolia <luca.risolia@studio.unibo.it>
      Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
      Cc: Eric Piel <eric.piel@tremplin-utc.net>
      Cc: linux-media@vger.kernel.org
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      bafeafea
  14. 31 10月, 2011 1 次提交
  15. 26 10月, 2011 1 次提交
  16. 19 5月, 2011 1 次提交
  17. 24 1月, 2011 1 次提交
  18. 27 10月, 2010 1 次提交
  19. 11 8月, 2010 6 次提交
  20. 29 10月, 2009 1 次提交
    • R
      param: fix lots of bugs with writing charp params from sysfs, by leaking mem. · 65afac7d
      Rusty Russell 提交于
      e180a6b7 "param: fix charp parameters set via sysfs" fixed the case
      where charp parameters written via sysfs were freed, leaving drivers
      accessing random memory.
      
      Unfortunately, storing a flag in the kparam struct was a bad idea: it's
      rodata so setting it causes an oops on some archs.  But that's not all:
      
      1) module_param_array() on charp doesn't work reliably, since we use an
         uninitialized temporary struct kernel_param.
      2) there's a fundamental race if a module uses this parameter and then
         it's changed: they will still access the old, freed, memory.
      
      The simplest fix (ie. for 2.6.32) is to never free the memory.  This
      prevents all these problems, at cost of a memory leak.  In practice, there
      are only 18 places where a charp is writable via sysfs, and all are
      root-only writable.
      Reported-by: NTakashi Iwai <tiwai@suse.de>
      Cc: Sitsofe Wheeler <sitsofe@yahoo.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Christof Schmitt <christof.schmitt@de.ibm.com>
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: stable@kernel.org
      65afac7d
  21. 12 6月, 2009 3 次提交
  22. 31 3月, 2009 1 次提交
  23. 22 10月, 2008 2 次提交
    • R
      core_param() for genuinely core kernel parameters · 67e67cea
      Rusty Russell 提交于
      There are a lot of one-liner uses of __setup() in the kernel: they're
      cumbersome and not queryable (definitely not settable) via /sys.  Yet
      it's ugly to simplify them to module_param(), because by default that
      inserts a prefix of the module name (usually filename).
      
      So, introduce a "core_param".  The parameter gets no prefix, but
      appears in /sys/module/kernel/parameters/ (if non-zero perms arg).  I
      thought about using the name "core", but that's more common than
      "kernel".  And if you create a module called "kernel", you will die
      a horrible death.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      67e67cea
    • R
      module: check kernel param length at compile time, not runtime · 730b69d2
      Rusty Russell 提交于
      The kparam code tries to handle over-length parameter prefixes at
      runtime.  Not only would I bet this has never been tested, it's not
      clear that truncating names is a good idea either.
      
      So let's check at compile time.  We need to move the #define to
      moduleparam.h to do this, though.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      730b69d2
  24. 14 2月, 2008 1 次提交
  25. 29 1月, 2008 1 次提交
  26. 17 10月, 2007 1 次提交