Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  • Arnd Bergmann's avatar
    kallsyms: rework symbol lookup return codes · 7e1f4eb9
    Arnd Bergmann authored
    Building with W=1 in some configurations produces a false positive
    warning for kallsyms:
    
    kernel/kallsyms.c: In function '__sprint_symbol.isra':
    kernel/kallsyms.c:503:17: error: 'strcpy' source argument is the same as destination [-Werror=restrict]
      503 |                 strcpy(buffer, name);
          |                 ^~~~~~~~~~~~~~~~~~~~
    
    This originally showed up while building with -O3, but later started
    happening in other configurations as well, depending on inlining
    decisions. The underlying issue is that the local 'name' variable is
    always initialized to the be the same as 'buffer' in the called functions
    that fill the buffer, which gcc notices while inlining, though it could
    see that the address check always skips the copy.
    
    The calling conventions here are rather unusual, as all of the internal
    lookup functions (bpf_address_lookup, ftrace_mod_address_lookup,
    ftrace_func_address_lookup, module_address_lookup and
    kallsyms_lookup_buildid) already use the pro...
    7e1f4eb9