1. 24 Aug, 2018 1 commit
    • Dirk Gouders's avatar
      kconfig: fix line numbers for if-entries in menu tree · 2f9e98db
      Dirk Gouders authored
      [ Upstream commit b2d00d7c ]
      
      The line numers for if-entries in the menu tree are off by one or more
      lines which is confusing when debugging for correctness of unrelated changes.
      
      According to the git log, commit a02f0570 (kconfig: improve
      error handling in the parser) was the last one that changed that part
      of the parser and replaced
      
      	"if_entry: T_IF expr T_EOL"
      by
      	"if_entry: T_IF expr nl"
      
      but the commit message does not state why this has been done.
      
      When reverting that part of the commit, only the line numers are
      corrected (checked with cdebug = DEBUG_PARSE in zconf.y), otherwise
      the menu tree remains unchanged (checked with zconfdump() enabled in
      conf.c).
      
      An example for the corrected line numbers:
      
      drivers/soc/Kconfig:15:source drivers/soc/tegra/Kconfig
      drivers/soc/tegra/Kconfig:4:if
      drivers/soc/tegra/Kconfig:6:if
      
      changes to:
      
      drivers/soc/Kconfig:15:source drivers/soc/tegra/Kconfig
      drivers/soc/tegra/Kconfig:1:if
      drivers/soc/tegra/Kconfig:4:if
      Signed-off-by: default avatarDirk Gouders <dirk@gouders.net>
      Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2f9e98db
  2. 11 Jun, 2018 1 commit
    • Nathan Chancellor's avatar
      kconfig: Avoid format overflow warning from GCC 8.1 · d58cf419
      Nathan Chancellor authored
      commit 2ae89c7a upstream.
      
      In file included from scripts/kconfig/zconf.tab.c:2485:
      scripts/kconfig/confdata.c: In function ‘conf_write’:
      scripts/kconfig/confdata.c:773:22: warning: ‘%s’ directive writing likely 7 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
        sprintf(newname, "%s%s", dirname, basename);
                            ^~
      scripts/kconfig/confdata.c:773:19: note: assuming directive output of 7 bytes
        sprintf(newname, "%s%s", dirname, basename);
                         ^~~~~~
      scripts/kconfig/confdata.c:773:2: note: ‘sprintf’ output 1 or more bytes (assuming 4104) into a destination of size 4097
        sprintf(newname, "%s%s", dirname, basename);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      scripts/kconfig/confdata.c:776:23: warning: ‘.tmpconfig.’ directive writing 11 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
         sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
                             ^~~~~~~~~~~
      scripts/kconfig/confdata.c:776:3: note: ‘sprintf’ output between 13 and 4119 bytes into a destination of size 4097
         sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Increase the size of tmpname and newname to make GCC happy.
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d58cf419
  3. 26 Apr, 2018 3 commits
  4. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      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 <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  5. 19 Aug, 2017 1 commit
  6. 22 Jun, 2017 1 commit
    • Randy Dunlap's avatar
      kconfig: fix sparse warnings in nconfig · ad818106
      Randy Dunlap authored
      Fix sparse warnings in scripts/kconfig/nconf* ('make nconfig'):
      
      ../scripts/kconfig/nconf.c:1071:32: warning: Using plain integer as NULL pointer
      ../scripts/kconfig/nconf.c:1238:30: warning: Using plain integer as NULL pointer
      ../scripts/kconfig/nconf.c:511:51: warning: Using plain integer as NULL pointer
      ../scripts/kconfig/nconf.c:1460:6: warning: symbol 'setup_windows' was not declared. Should it be static?
      ../scripts/kconfig/nconf.c:274:12: warning: symbol 'current_instructions' was not declared. Should it be static?
      ../scripts/kconfig/nconf.c:308:22: warning: symbol 'function_keys' was not declared. Should it be static?
      ../scripts/kconfig/nconf.gui.c:132:17: warning: non-ANSI function declaration of function 'set_colors'
      ../scripts/kconfig/nconf.gui.c:195:24: warning: Using plain integer as NULL pointer
      
      nconf.gui.o before/after files are the same.
      nconf.o before/after files are the same until the 'static' function
      declarations are added.
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      ad818106
  7. 09 Jun, 2017 1 commit
    • Borislav Petkov's avatar
      kconfig: Check for libncurses before menuconfig · ff85a1a8
      Borislav Petkov authored
      There is a check and a nice user-friendly message when the curses
      library is not present on the system and the user wants to do "make
      menuconfig". It doesn't get issued, though. Instead, we fail the build
      when mconf.c doesn't find the curses.h header:
      
          HOSTCC  scripts/kconfig/mconf.o
        In file included from scripts/kconfig/mconf.c:23:0:
        scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory
         #include CURSES_LOC
                            ^
        compilation terminated.
      
      Make that check a prerequisite to mconf so that the user sees the error
      message instead:
      
        $ make menuconfig
         *** Unable to find the ncurses libraries or the
         *** required header files.
         *** 'make menuconfig' requires the ncurses libraries.
         ***
         *** Install ncurses (ncurses-devel) and try again.
         ***
        scripts/kconfig/Makefile:203: recipe for target 'scripts/kconfig/dochecklxdialog' failed
        make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
        Makefile:548: recipe for target 'menuconfig' failed
        make: *** [menuconfig] Error 2
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      ff85a1a8
  8. 14 May, 2017 1 commit
    • Kamil Rytarowski's avatar
      scripts: Switch to more portable Perl shebang · cb77f0d6
      Kamil Rytarowski authored
      The default NetBSD package manager is pkgsrc and it installs Perl
      along other third party programs under custom and configurable prefix.
      The default prefix for binary prebuilt packages is /usr/pkg, and the
      Perl executable lands in /usr/pkg/bin/perl.
      
      This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's
      the most portable solution that should work for almost everybody.
      Perl's executable is detected automatically.
      
      This change switches -w option passed to the executable with more
      modern "use warnings;" approach. There is no functional change to the
      default behavior.
      
      While there, drop "require 5" from scripts/namespace.pl (Perl from 1994?).
      Signed-off-by: default avatarKamil Rytarowski <n54@gmx.com>
      Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      cb77f0d6
  9. 21 Mar, 2017 1 commit
    • Nicolas Iooss's avatar
      gconfig: remove misleading parentheses around a condition · 9be3213b
      Nicolas Iooss authored
      When building the kernel with clang, the compiler complains about the
      presence of a condition inside two pairs of parentheses:
      
          scripts/kconfig/gconf.c:917:19: error: equality comparison with
          extraneous parentheses [-Werror,-Wparentheses-equality]
                          } else if ((col == COL_OPTION)) {
                                      ~~~~^~~~~~~~~~~~~
          scripts/kconfig/gconf.c:917:19: note: remove extraneous parentheses
          around the comparison to silence this warning
                          } else if ((col == COL_OPTION)) {
                                     ~    ^            ~
          scripts/kconfig/gconf.c:917:19: note: use '=' to turn this equality
          comparison into an assignment
                          } else if ((col == COL_OPTION)) {
                                          ^~
                                          =
      
      Silence this warning by removing a level of parentheses.
      Signed-off-by: default avatarNicolas Iooss <nicolas.iooss_linux@m4x.org>
      Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      9be3213b
  10. 11 Dec, 2016 3 commits
  11. 01 Dec, 2016 1 commit
  12. 29 Nov, 2016 1 commit
  13. 16 Nov, 2016 2 commits
  14. 10 May, 2016 2 commits
    • Dirk Gouders's avatar
      kconfig/symbol.c: handle choice_values that depend on 'm' symbols · fa64e5f6
      Dirk Gouders authored
      If choices consist of choice_values of type tristate that depend on
      symbols set to 'm', those choice_values are not set to 'n' if the
      choice is changed from 'm' to 'y' (in which case only one active
      choice_value is allowed). Those values are also written to the config
      file causing modules to be built when they should not.
      
      The following config can be used to reproduce and examine the problem;
      with the frontend of your choice set "Choice 0" and "Choice 1" to 'm',
      then set "Tristate Choice" to 'y' and save the configuration:
      
      config modules
      	boolean modules
      	default y
      	option modules
      
      config dependency
      	tristate "Dependency"
      	default m
      
      choice
      	prompt "Tristate Choice"
      	default choice0
      
      config choice0
      	tristate "Choice 0"
      
      config choice1
      	tristate "Choice 1"
      	depends on dependency
      
      endchoice
      
      This patch sets tristate choice_values' visibility that depend on
      symbols set to 'm' to 'n' if the corresponding choice is set to 'y'.
      
      This makes them disappear from the choice list and will also cause the
      choice_values' value set to 'n' in sym_calc_value() and as a result
      they are written as "not set" to the resulting .config file.
      Reported-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarDirk Gouders <dirk@gouders.net>
      Tested-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Tested-by: default avatarRoger Quadros <rogerq@ti.com>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      fa64e5f6
    • Paul Bolle's avatar
      kconfig: add unexpected data itself to warning · a4663911
      Paul Bolle authored
      If the .config parser runs into unexpected data it emits warnings like:
          .config:6911:warning: unexpected data
      
      Add the unexpected data itself to this warning. That makes it easier to
      discover what is actually going wrong:
           .config:6911:warning: unexpected data: CONFOG_CHARGER_TPS65217=m
      Signed-off-by: default avatarPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      a4663911
  15. 26 Apr, 2016 6 commits
  16. 01 Feb, 2016 2 commits
    • Al Viro's avatar
      unbreak allmodconfig KCONFIG_ALLCONFIG=... · 6b87b70c
      Al Viro authored
      	Prior to 3.13 make allmodconfig KCONFIG_ALLCONFIG=/dev/null used
      to be equivalent to make allmodconfig; these days it hardwires MODULES to n.
      In fact, any KCONFIG_ALLCONFIG that doesn't set MODULES explicitly is
      treated as if it set it to n.
      
      	Regression had been introduced by commit cfa98f ("kconfig: do not
      override symbols already set"); what happens is that conf_read_simple()
      does sym_calc_value(modules_sym) on exit, which leaves SYMBOL_VALID set and
      has conf_set_all_new_symbols() skip modules_sym.
      
      	It's pretty easy to fix - simply move that call of sym_calc_value()
      into the callers, except for the ones in KCONFIG_ALLCONFIG handling.
      Objections?
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Fixes: cfa98f2e ("kconfig: do not override symbols already set")
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      6b87b70c
    • Jan Beulich's avatar
      scripts/kconfig: allow building with make 3.80 again · 42f9d3c6
      Jan Beulich authored
      Documentation/Changes still lists this as the minimal required version,
      so it ought to remain usable for the time being.
      
      Fixes: d2036f30 ("scripts/kconfig/Makefile: Allow KBUILD_DEFCONFIG to be a target")
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarMichal Marek <mmarek@suse.com>
      42f9d3c6
  17. 11 Jan, 2016 1 commit
  18. 05 Jan, 2016 1 commit
  19. 10 Dec, 2015 1 commit
  20. 02 Nov, 2015 2 commits
  21. 20 Oct, 2015 1 commit
  22. 15 Oct, 2015 1 commit
    • Michael Ellerman's avatar
      scripts/kconfig/Makefile: Fix KBUILD_DEFCONFIG check when building with O= · bd960f09
      Michael Ellerman authored
      My recent commit d2036f30 ("scripts/kconfig/Makefile: Allow
      KBUILD_DEFCONFIG to be a target"), contained a bug in that when it
      checks if KBUILD_DEFCONFIG is a file it forgets to prepend $(srctree) to
      the path.
      
      This causes the build to fail when building out of tree (with O=), and
      when the value of KBUILD_DEFCONFIG is 'defconfig'. In that case we will
      fail to find the 'defconfig' file, because we look in the build
      directory not $(srctree), and so we will call Make again with
      'defconfig' as the target. From there we loop infinitely calling 'make
      defconfig' again and again.
      
      The fix is simple, we need to look for the file under $(srctree).
      
      Fixes: d2036f30 ("scripts/kconfig/Makefile: Allow KBUILD_DEFCONFIG to be a target")
      Reported-by: default avatarOlof Johansson <olof@lixom.net>
      Acked-by: default avatarMichal Marek <mmarek@suse.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      bd960f09
  23. 14 Oct, 2015 5 commits