* [linux-next:master 1386/5845] kernel/module/kallsyms.c:424:3: warning: Assignment of function parameter has no effect outside the function. [uselessAssignmentArg]
@ 2022-04-23 10:31 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-04-23 10:31 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 6934 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Aaron Tomlin <atomlin@redhat.com>
CC: Luis Chamberlain <mcgrof@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: e7d6987e09a328d4a949701db40ef63fbb970670
commit: 91fb02f31505dc22262b13a129550f470ab90a79 [1386/5845] module: Move kallsyms support into a separate file
:::::: branch date: 28 hours ago
:::::: commit date: 3 weeks ago
compiler: powerpc64-linux-gcc (GCC) 11.2.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout 91fb02f31505dc22262b13a129550f470ab90a79
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck warnings: (new ones prefixed by >>)
kernel/module/kallsyms.c:142:24: warning: Redundant assignment of 'mod->core_layout.size' to itself. [selfAssignment]
mod->core_layout.size = debug_align(mod->core_layout.size);
^
>> kernel/module/kallsyms.c:157:24: warning: Redundant assignment of 'mod->init_layout.size' to itself. [selfAssignment]
mod->init_layout.size = debug_align(mod->init_layout.size);
^
>> kernel/module/main.c:2113:26: warning: Redundant assignment of 'mod->core_layout.size' to itself. [selfAssignment]
mod->core_layout.size = debug_align(mod->core_layout.size);
^
kernel/module/main.c:2117:26: warning: Redundant assignment of 'mod->core_layout.size' to itself. [selfAssignment]
mod->core_layout.size = debug_align(mod->core_layout.size);
^
kernel/module/main.c:2121:26: warning: Redundant assignment of 'mod->core_layout.size' to itself. [selfAssignment]
mod->core_layout.size = debug_align(mod->core_layout.size);
^
kernel/module/main.c:2125:26: warning: Redundant assignment of 'mod->core_layout.size' to itself. [selfAssignment]
mod->core_layout.size = debug_align(mod->core_layout.size);
^
>> kernel/module/main.c:2147:26: warning: Redundant assignment of 'mod->init_layout.size' to itself. [selfAssignment]
mod->init_layout.size = debug_align(mod->init_layout.size);
^
kernel/module/main.c:2151:26: warning: Redundant assignment of 'mod->init_layout.size' to itself. [selfAssignment]
mod->init_layout.size = debug_align(mod->init_layout.size);
^
kernel/module/main.c:2162:26: warning: Redundant assignment of 'mod->init_layout.size' to itself. [selfAssignment]
mod->init_layout.size = debug_align(mod->init_layout.size);
^
>> kernel/module/main.c:357:20: warning: Local variable 'arr' shadows outer variable [shadowVariable]
struct symsearch arr[] = {
^
kernel/module/main.c:339:32: note: Shadowed declaration
static const struct symsearch arr[] = {
^
kernel/module/main.c:357:20: note: Shadow variable
struct symsearch arr[] = {
^
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> kernel/module/kallsyms.c:424:3: warning: Assignment of function parameter has no effect outside the function. [uselessAssignmentArg]
symnum -= kallsyms->num_symtab;
^
>> kernel/module/main.c:2261:70: warning: Parameter 'debug' can be declared with const [constParameter]
static void dynamic_debug_remove(struct module *mod, struct _ddebug *debug)
^
>> lib/iov_iter.c:1884:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
ret = 0;
^
lib/iov_iter.c:1863:10: note: ret is initialized
int ret = -EFAULT, i;
^
lib/iov_iter.c:1884:6: note: ret is overwritten
ret = 0;
^
>> lib/iov_iter.c:1837:61: warning: Parameter 'old' can be declared with const [constParameter]
const void *dup_iter(struct iov_iter *new, struct iov_iter *old, gfp_t flags)
^
>> lib/vsprintf.c:588:41: warning: Parameter 'end' can be declared with const [constParameter]
static void move_right(char *buf, char *end, unsigned len, unsigned spaces)
^
vim +424 kernel/module/kallsyms.c
91fb02f31505dc Aaron Tomlin 2022-03-22 400
91fb02f31505dc Aaron Tomlin 2022-03-22 401 int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
91fb02f31505dc Aaron Tomlin 2022-03-22 402 char *name, char *module_name, int *exported)
91fb02f31505dc Aaron Tomlin 2022-03-22 403 {
91fb02f31505dc Aaron Tomlin 2022-03-22 404 struct module *mod;
91fb02f31505dc Aaron Tomlin 2022-03-22 405
91fb02f31505dc Aaron Tomlin 2022-03-22 406 preempt_disable();
91fb02f31505dc Aaron Tomlin 2022-03-22 407 list_for_each_entry_rcu(mod, &modules, list) {
91fb02f31505dc Aaron Tomlin 2022-03-22 408 struct mod_kallsyms *kallsyms;
91fb02f31505dc Aaron Tomlin 2022-03-22 409
91fb02f31505dc Aaron Tomlin 2022-03-22 410 if (mod->state == MODULE_STATE_UNFORMED)
91fb02f31505dc Aaron Tomlin 2022-03-22 411 continue;
91fb02f31505dc Aaron Tomlin 2022-03-22 412 kallsyms = rcu_dereference_sched(mod->kallsyms);
91fb02f31505dc Aaron Tomlin 2022-03-22 413 if (symnum < kallsyms->num_symtab) {
91fb02f31505dc Aaron Tomlin 2022-03-22 414 const Elf_Sym *sym = &kallsyms->symtab[symnum];
91fb02f31505dc Aaron Tomlin 2022-03-22 415
91fb02f31505dc Aaron Tomlin 2022-03-22 416 *value = kallsyms_symbol_value(sym);
91fb02f31505dc Aaron Tomlin 2022-03-22 417 *type = kallsyms->typetab[symnum];
91fb02f31505dc Aaron Tomlin 2022-03-22 418 strscpy(name, kallsyms_symbol_name(kallsyms, symnum), KSYM_NAME_LEN);
91fb02f31505dc Aaron Tomlin 2022-03-22 419 strscpy(module_name, mod->name, MODULE_NAME_LEN);
91fb02f31505dc Aaron Tomlin 2022-03-22 420 *exported = is_exported(name, *value, mod);
91fb02f31505dc Aaron Tomlin 2022-03-22 421 preempt_enable();
91fb02f31505dc Aaron Tomlin 2022-03-22 422 return 0;
91fb02f31505dc Aaron Tomlin 2022-03-22 423 }
91fb02f31505dc Aaron Tomlin 2022-03-22 @424 symnum -= kallsyms->num_symtab;
91fb02f31505dc Aaron Tomlin 2022-03-22 425 }
91fb02f31505dc Aaron Tomlin 2022-03-22 426 preempt_enable();
91fb02f31505dc Aaron Tomlin 2022-03-22 427 return -ERANGE;
91fb02f31505dc Aaron Tomlin 2022-03-22 428 }
91fb02f31505dc Aaron Tomlin 2022-03-22 429
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-23 10:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-23 10:31 [linux-next:master 1386/5845] kernel/module/kallsyms.c:424:3: warning: Assignment of function parameter has no effect outside the function. [uselessAssignmentArg] kernel test robot
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.