06 Jan, 2020

1 commit

  • Disable a couple of compilation warnings (which are treated as errors)
    on strlcpy() definition and declaration, allowing users to compile perf
    and kernel (objtool) when:

    1. glibc have strlcpy() (such as in ALT Linux since 2004) objtool and
    perf build fails with this (in gcc):

    In file included from exec-cmd.c:3:
    tools/include/linux/string.h:20:15: error: redundant redeclaration of ‘strlcpy’ [-Werror=redundant-decls]
    20 | extern size_t strlcpy(char *dest, const char *src, size_t size);

    2. clang ignores `-Wredundant-decls', but produces another warning when
    building perf:

    CC util/string.o
    ../lib/string.c:99:8: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
    size_t __weak strlcpy(char *dest, const char *src, size_t size)
    ../../tools/include/linux/compiler.h:66:34: note: expanded from macro '__weak'
    # define __weak __attribute__((weak))
    /usr/include/bits/string_fortified.h:151:8: note: previous definition is here
    __NTH (strlcpy (char *__restrict __dest, const char *__restrict __src,

    Committer notes:

    The

    #pragma GCC diagnostic

    directive was introduced in gcc 4.6, so check for that as well.

    Fixes: ce99091 ("perf tools: Move strlcpy() from perf to tools/lib/string.c")
    Fixes: 0215d59 ("tools lib: Reinstate strlcpy() header guard with __UCLIBC__")
    Resolves: https://bugzilla.kernel.org/show_bug.cgi?id=118481
    Signed-off-by: Vitaly Chikunov
    Reviewed-by: Dmitry Levin
    Cc: Dmitry Levin
    Cc: Josh Poimboeuf
    Cc: kbuild test robot
    Cc: Peter Zijlstra
    Cc: stable@vger.kernel.org
    Cc: Vineet Gupta
    Link: http://lore.kernel.org/lkml/20191224172029.19690-1-vt@altlinux.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Vitaly Chikunov
     

02 Jul, 2019

1 commit


26 Jun, 2019

2 commits

  • Since we're working on moving stuff out of tools/perf/util/ to
    tools/lib/, take the opportunity to adopt routines from the kernel that
    are equivalent, so that tools/ code look more like the kernel.

    Cc: Adrian Hunter
    Cc: André Goddard Rosa
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-zqy1zdu2ok17qvi0ytk8z13c@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Same implementation, will be used to replace ad-hoc equivalent code in
    tools/.

    Cc: Adrian Hunter
    Cc: André Goddard Rosa
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: https://lkml.kernel.org/n/tip-dig691cg9ripvoiprpidthw7@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

21 Jul, 2017

2 commits

  • Getting support for "on", "off" introduced in a81a5a17d44b ("lib: add
    "on"/"off" support to kstrtobool") and making it check for NULL,
    introduced in ef951599074b ("lib: move strtobool() to kstrtobool()").

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Wang Nan
    Cc: Kees Cook
    Link: http://lkml.kernel.org/n/tip-mu8ghin4rklacmmubzwv8td7@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • Replacing prefixcmp(), same purpose, inverted result, so standardize on
    the kernel variant, to reduce silly differences among tools/ and the
    kernel sources, making it easier for people to work in both codebases.

    And then doing:

    if (strstarts(option, "no-"))

    Looks clearer than doing:

    if (!prefixcmp(option, "no-"))

    To figure out if option starts witn "no-".

    Cc: Adrian Hunter
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Josh Poimboeuf
    Cc: Namhyung Kim
    Cc: Rusty Russell
    Cc: Wang Nan
    Link: http://lkml.kernel.org/n/tip-kaei42gi7lpa8subwtv7eug8@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     

27 Apr, 2017

1 commit


17 Dec, 2015

1 commit

  • strlcpy() will be needed by the subcmd library. Move it to the shared
    tools/lib/string.c file which can be used by other tools.

    Signed-off-by: Josh Poimboeuf
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/71e2804b973bf39ad3d3b9be10f99f2ea630be46.1450193761.git.jpoimboe@redhat.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Josh Poimboeuf
     

19 Nov, 2015

2 commits

  • Copying it to tools/lib/string.c, the counterpart to the kernel's
    lib/string.c.

    This is preparation for enhancing BPF program configuration, which will
    allow config string like 'inlines=yes'.

    Signed-off-by: Wang Nan
    Cc: Alexei Starovoitov
    Cc: Jonathan Cameron
    Cc: Masami Hiramatsu
    Cc: Zefan Li
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1447675815-166222-6-git-send-email-wangnan0@huawei.com
    [ Copied it to tools/lib/string.c instead, to make it usable by other tools/ ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     
  • That will contain more string functions with counterparts, sometimes
    verbatim copies, in the kernel.

    Acked-by: Wang Nan
    Cc: Adrian Hunter
    Cc: Alexey Dobriyan
    Cc: David Ahern
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/n/tip-rah6g97kn21vfgmlramorz6o@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo