aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJames Morris <james.morris@microsoft.com>2018-09-04 14:35:54 -0400
committerJames Morris <james.morris@microsoft.com>2018-09-04 14:35:54 -0400
commite42f6f9be4f83c537aa81b4c6239ea94ff5b29ce (patch)
treef956a5ea0e83fc6d0df3e64681e7bbc1f201f3ee /scripts
parent4408e300a67ab2ce2505087986a9fe922c800ffd (diff)
parent57361846b52bc686112da6ca5368d11210796804 (diff)
Merge tag 'v4.19-rc2' into next-general
Sync to Linux 4.19-rc2 for downstream developers.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/.gitignore1
-rw-r--r--scripts/Kbuild.include17
-rw-r--r--scripts/Makefile5
-rw-r--r--scripts/Makefile.build27
-rw-r--r--scripts/Makefile.clean4
-rw-r--r--scripts/Makefile.gcc-plugins37
-rw-r--r--scripts/Makefile.host24
-rw-r--r--scripts/Makefile.lib7
-rw-r--r--scripts/Makefile.modbuiltin8
-rw-r--r--scripts/Makefile.modinst4
-rw-r--r--scripts/Makefile.modpost6
-rw-r--r--scripts/Makefile.modsign3
-rw-r--r--scripts/Makefile.ubsan4
-rw-r--r--scripts/basic/.gitignore1
-rw-r--r--scripts/basic/Makefile1
-rw-r--r--scripts/bin2c.c (renamed from scripts/basic/bin2c.c)0
-rwxr-xr-xscripts/cc-can-link.sh2
-rwxr-xr-xscripts/checkpatch.pl226
-rwxr-xr-xscripts/checkstack.pl11
-rwxr-xr-xscripts/clang-version.sh2
-rwxr-xr-xscripts/coccicheck5
-rw-r--r--scripts/coccinelle/api/alloc/zalloc-simple.cocci41
-rw-r--r--scripts/coccinelle/api/atomic_as_refcounter.cocci129
-rw-r--r--scripts/coccinelle/tests/doubletest.cocci34
-rwxr-xr-xscripts/depmod.sh8
-rwxr-xr-xscripts/documentation-file-ref-check6
-rw-r--r--scripts/dtc/Makefile18
-rwxr-xr-xscripts/extract-vmlinux2
-rw-r--r--scripts/gcc-plugins/Kconfig142
-rw-r--r--scripts/gcc-plugins/Makefile5
-rw-r--r--scripts/gcc-plugins/gcc-common.h26
-rwxr-xr-xscripts/gcc-x86_64-has-stack-protector.sh2
-rwxr-xr-xscripts/gen_initramfs_list.sh328
-rwxr-xr-xscripts/get_maintainer.pl56
-rw-r--r--scripts/kconfig/Makefile37
-rw-r--r--scripts/kconfig/check-pkgconfig.sh8
-rw-r--r--scripts/kconfig/conf.c44
-rw-r--r--scripts/kconfig/confdata.c156
-rw-r--r--scripts/kconfig/expr.h6
-rw-r--r--scripts/kconfig/gconf.c5
-rw-r--r--scripts/kconfig/lkc.h2
-rw-r--r--scripts/kconfig/lkc_proto.h4
-rw-r--r--scripts/kconfig/mconf.c10
-rw-r--r--scripts/kconfig/menu.c2
-rw-r--r--scripts/kconfig/nconf.c8
-rw-r--r--scripts/kconfig/preprocess.c2
-rw-r--r--scripts/kconfig/qconf.cc3
-rw-r--r--scripts/kconfig/symbol.c71
-rw-r--r--scripts/kconfig/tests/err_recursive_dep/Kconfig (renamed from scripts/kconfig/tests/warn_recursive_dep/Kconfig)3
-rw-r--r--scripts/kconfig/tests/err_recursive_dep/__init__.py10
-rw-r--r--scripts/kconfig/tests/err_recursive_dep/expected_stderr38
-rw-r--r--scripts/kconfig/tests/warn_recursive_dep/__init__.py9
-rw-r--r--scripts/kconfig/tests/warn_recursive_dep/expected_stderr30
-rw-r--r--scripts/kconfig/util.c30
-rw-r--r--scripts/kconfig/zconf.y12
-rwxr-xr-xscripts/kernel-doc20
-rwxr-xr-xscripts/link-vmlinux.sh4
-rw-r--r--scripts/mod/devicetable-offsets.c4
-rw-r--r--scripts/mod/file2alias.c13
-rw-r--r--scripts/mod/modpost.c11
-rwxr-xr-xscripts/package/buildtar12
-rwxr-xr-xscripts/package/mkdebian68
-rwxr-xr-xscripts/spdxcheck.py11
-rw-r--r--scripts/spelling.txt90
-rwxr-xr-xscripts/tags.sh3
-rwxr-xr-xscripts/tracing/draw_functrace.py2
-rwxr-xr-xscripts/ver_linux14
67 files changed, 1109 insertions, 825 deletions
diff --git a/scripts/.gitignore b/scripts/.gitignore
index 0442c06eefcb..12d302d70128 100644
--- a/scripts/.gitignore
+++ b/scripts/.gitignore
@@ -1,6 +1,7 @@
1# 1#
2# Generated files 2# Generated files
3# 3#
4bin2c
4conmakehash 5conmakehash
5kallsyms 6kallsyms
6pnmtologo 7pnmtologo
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index c8156d61678c..ce53639a864a 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -56,7 +56,7 @@ kecho := $($(quiet)kecho)
56define filechk 56define filechk
57 $(Q)set -e; \ 57 $(Q)set -e; \
58 mkdir -p $(dir $@); \ 58 mkdir -p $(dir $@); \
59 $(filechk_$(1)) < $< > $@.tmp; \ 59 $(filechk_$(1)) > $@.tmp; \
60 if [ -r $@ ] && cmp -s $@ $@.tmp; then \ 60 if [ -r $@ ] && cmp -s $@ $@.tmp; then \
61 rm -f $@.tmp; \ 61 rm -f $@.tmp; \
62 else \ 62 else \
@@ -126,7 +126,7 @@ cc-option = $(call __cc-option, $(CC),\
126# hostcc-option 126# hostcc-option
127# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) 127# Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586)
128hostcc-option = $(call __cc-option, $(HOSTCC),\ 128hostcc-option = $(call __cc-option, $(HOSTCC),\
129 $(HOSTCFLAGS) $(HOST_EXTRACFLAGS),$(1),$(2)) 129 $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS),$(1),$(2))
130 130
131# cc-option-yn 131# cc-option-yn
132# Usage: flag := $(call cc-option-yn,-march=winchip-c6) 132# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
@@ -153,18 +153,14 @@ cc-fullversion = $(shell $(CONFIG_SHELL) \
153# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) 153# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
154cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo $(3) || echo $(4)) 154cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo $(3) || echo $(4))
155 155
156# cc-if-fullversion
157# Usage: EXTRA_CFLAGS += $(call cc-if-fullversion, -lt, 040502, -O1)
158cc-if-fullversion = $(shell [ $(cc-fullversion) $(1) $(2) ] && echo $(3) || echo $(4))
159
160# cc-ldoption 156# cc-ldoption
161# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) 157# Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
162cc-ldoption = $(call try-run,\ 158cc-ldoption = $(call try-run,\
163 $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) 159 $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
164 160
165# ld-option 161# ld-option
166# Usage: LDFLAGS += $(call ld-option, -X) 162# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
167ld-option = $(call try-run, $(LD) $(LDFLAGS) $(1) -v,$(1),$(2)) 163ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
168 164
169# ar-option 165# ar-option
170# Usage: KBUILD_ARFLAGS := $(call ar-option,D) 166# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
@@ -214,7 +210,7 @@ hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
214# Prefix -I with $(srctree) if it is not an absolute path. 210# Prefix -I with $(srctree) if it is not an absolute path.
215# skip if -I has no parameter 211# skip if -I has no parameter
216addtree = $(if $(patsubst -I%,%,$(1)), \ 212addtree = $(if $(patsubst -I%,%,$(1)), \
217$(if $(filter-out -I/% -I./% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1))) 213$(if $(filter-out -I/% -I./% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)),$(1))
218 214
219# Find all -I options and call addtree 215# Find all -I options and call addtree
220flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) 216flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
@@ -400,3 +396,6 @@ endif
400endef 396endef
401# 397#
402############################################################################### 398###############################################################################
399
400# delete partially updated (i.e. corrupted) files on error
401.DELETE_ON_ERROR:
diff --git a/scripts/Makefile b/scripts/Makefile
index 25ab143cbe14..61affa300d25 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -10,6 +10,7 @@
10 10
11HOST_EXTRACFLAGS += -I$(srctree)/tools/include 11HOST_EXTRACFLAGS += -I$(srctree)/tools/include
12 12
13hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c
13hostprogs-$(CONFIG_KALLSYMS) += kallsyms 14hostprogs-$(CONFIG_KALLSYMS) += kallsyms
14hostprogs-$(CONFIG_LOGO) += pnmtologo 15hostprogs-$(CONFIG_LOGO) += pnmtologo
15hostprogs-$(CONFIG_VT) += conmakehash 16hostprogs-$(CONFIG_VT) += conmakehash
@@ -22,8 +23,8 @@ hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert
22 23
23HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include 24HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include
24HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include 25HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
25HOSTLOADLIBES_sign-file = -lcrypto 26HOSTLDLIBS_sign-file = -lcrypto
26HOSTLOADLIBES_extract-cert = -lcrypto 27HOSTLDLIBS_extract-cert = -lcrypto
27 28
28always := $(hostprogs-y) $(hostprogs-m) 29always := $(hostprogs-y) $(hostprogs-m)
29 30
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index e7889f486ca1..5a2d1c9578a0 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -53,13 +53,6 @@ endif
53 53
54include scripts/Makefile.lib 54include scripts/Makefile.lib
55 55
56ifdef host-progs
57ifneq ($(hostprogs-y),$(host-progs))
58$(warning kbuild: $(obj)/Makefile - Usage of host-progs is deprecated. Please replace with hostprogs-y!)
59hostprogs-y += $(host-progs)
60endif
61endif
62
63# Do not include host rules unless needed 56# Do not include host rules unless needed
64ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),) 57ifneq ($(hostprogs-y)$(hostprogs-m)$(hostlibs-y)$(hostlibs-m)$(hostcxxlibs-y)$(hostcxxlibs-m),)
65include scripts/Makefile.host 58include scripts/Makefile.host
@@ -197,7 +190,7 @@ cmd_modversions_c = \
197 $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ 190 $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
198 > $(@D)/.tmp_$(@F:.o=.ver); \ 191 > $(@D)/.tmp_$(@F:.o=.ver); \
199 \ 192 \
200 $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ 193 $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
201 -T $(@D)/.tmp_$(@F:.o=.ver); \ 194 -T $(@D)/.tmp_$(@F:.o=.ver); \
202 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ 195 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
203 else \ 196 else \
@@ -206,11 +199,8 @@ cmd_modversions_c = \
206endif 199endif
207 200
208ifdef CONFIG_FTRACE_MCOUNT_RECORD 201ifdef CONFIG_FTRACE_MCOUNT_RECORD
209# gcc 5 supports generating the mcount tables directly 202ifndef CC_USING_RECORD_MCOUNT
210ifneq ($(call cc-option,-mrecord-mcount,y),y) 203# compiler will not generate __mcount_loc use recordmcount or recordmcount.pl
211KBUILD_CFLAGS += -mrecord-mcount
212else
213# else do it all manually
214ifdef BUILD_C_RECORDMCOUNT 204ifdef BUILD_C_RECORDMCOUNT
215ifeq ("$(origin RECORDMCOUNT_WARN)", "command line") 205ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
216 RECORDMCOUNT_FLAGS = -w 206 RECORDMCOUNT_FLAGS = -w
@@ -230,7 +220,7 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
230 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \ 220 "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
231 "$(if $(CONFIG_64BIT),64,32)" \ 221 "$(if $(CONFIG_64BIT),64,32)" \
232 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \ 222 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
233 "$(LD)" "$(NM)" "$(RM)" "$(MV)" \ 223 "$(LD) $(KBUILD_LDFLAGS)" "$(NM)" "$(RM)" "$(MV)" \
234 "$(if $(part-of-module),1,0)" "$(@)"; 224 "$(if $(part-of-module),1,0)" "$(@)";
235recordmcount_source := $(srctree)/scripts/recordmcount.pl 225recordmcount_source := $(srctree)/scripts/recordmcount.pl
236endif # BUILD_C_RECORDMCOUNT 226endif # BUILD_C_RECORDMCOUNT
@@ -239,7 +229,7 @@ cmd_record_mcount = \
239 "$(CC_FLAGS_FTRACE)" ]; then \ 229 "$(CC_FLAGS_FTRACE)" ]; then \
240 $(sub_cmd_record_mcount) \ 230 $(sub_cmd_record_mcount) \
241 fi; 231 fi;
242endif # -record-mcount 232endif # CC_USING_RECORD_MCOUNT
243endif # CONFIG_FTRACE_MCOUNT_RECORD 233endif # CONFIG_FTRACE_MCOUNT_RECORD
244 234
245ifdef CONFIG_STACK_VALIDATION 235ifdef CONFIG_STACK_VALIDATION
@@ -256,8 +246,6 @@ objtool_args += --no-fp
256endif 246endif
257ifdef CONFIG_GCOV_KERNEL 247ifdef CONFIG_GCOV_KERNEL
258objtool_args += --no-unreachable 248objtool_args += --no-unreachable
259else
260objtool_args += $(call cc-ifversion, -lt, 0405, --no-unreachable)
261endif 249endif
262ifdef CONFIG_RETPOLINE 250ifdef CONFIG_RETPOLINE
263ifneq ($(RETPOLINE_CFLAGS),) 251ifneq ($(RETPOLINE_CFLAGS),)
@@ -404,7 +392,7 @@ cmd_modversions_S = \
404 $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ 392 $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
405 > $(@D)/.tmp_$(@F:.o=.ver); \ 393 > $(@D)/.tmp_$(@F:.o=.ver); \
406 \ 394 \
407 $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ 395 $(LD) $(KBUILD_LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \
408 -T $(@D)/.tmp_$(@F:.o=.ver); \ 396 -T $(@D)/.tmp_$(@F:.o=.ver); \
409 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ 397 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \
410 else \ 398 else \
@@ -590,7 +578,4 @@ endif
590# We never want them to be removed automatically. 578# We never want them to be removed automatically.
591.SECONDARY: $(targets) 579.SECONDARY: $(targets)
592 580
593# Declare the contents of the .PHONY variable as phony. We keep that
594# information in a variable se we can use it in if_changed and friends.
595
596.PHONY: $(PHONY) 581.PHONY: $(PHONY)
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
index 808d09f27ad4..0b80e3207b20 100644
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -38,7 +38,6 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
38 38
39__clean-files := $(extra-y) $(extra-m) $(extra-) \ 39__clean-files := $(extra-y) $(extra-m) $(extra-) \
40 $(always) $(targets) $(clean-files) \ 40 $(always) $(targets) $(clean-files) \
41 $(host-progs) \
42 $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \ 41 $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \
43 $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \ 42 $(hostlibs-y) $(hostlibs-m) $(hostlibs-) \
44 $(hostcxxlibs-y) $(hostcxxlibs-m) 43 $(hostcxxlibs-y) $(hostcxxlibs-m)
@@ -88,7 +87,4 @@ PHONY += $(subdir-ymn)
88$(subdir-ymn): 87$(subdir-ymn):
89 $(Q)$(MAKE) $(clean)=$@ 88 $(Q)$(MAKE) $(clean)=$@
90 89
91# Declare the contents of the .PHONY variable as phony. We keep that
92# information in a variable se we can use it in if_changed and friends.
93
94.PHONY: $(PHONY) 90.PHONY: $(PHONY)
diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
index c961b9a65d11..0a482f341576 100644
--- a/scripts/Makefile.gcc-plugins
+++ b/scripts/Makefile.gcc-plugins
@@ -1,33 +1,44 @@
1# SPDX-License-Identifier: GPL-2.0 1# SPDX-License-Identifier: GPL-2.0
2
2gcc-plugin-$(CONFIG_GCC_PLUGIN_CYC_COMPLEXITY) += cyc_complexity_plugin.so 3gcc-plugin-$(CONFIG_GCC_PLUGIN_CYC_COMPLEXITY) += cyc_complexity_plugin.so
3 4
4gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += latent_entropy_plugin.so 5gcc-plugin-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += latent_entropy_plugin.so
5gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) += -DLATENT_ENTROPY_PLUGIN 6gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) \
7 += -DLATENT_ENTROPY_PLUGIN
6ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY 8ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
7 DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable 9 DISABLE_LATENT_ENTROPY_PLUGIN += -fplugin-arg-latent_entropy_plugin-disable
8endif 10endif
11export DISABLE_LATENT_ENTROPY_PLUGIN
9 12
10gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so 13gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so
14
11gcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += structleak_plugin.so 15gcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += structleak_plugin.so
12gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE) += -fplugin-arg-structleak_plugin-verbose 16gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE) \
13gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) += -fplugin-arg-structleak_plugin-byref-all 17 += -fplugin-arg-structleak_plugin-verbose
14gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += -DSTRUCTLEAK_PLUGIN 18gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) \
19 += -fplugin-arg-structleak_plugin-byref-all
20gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) \
21 += -DSTRUCTLEAK_PLUGIN
15 22
16gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so 23gcc-plugin-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += randomize_layout_plugin.so
17gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) += -DRANDSTRUCT_PLUGIN 24gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT) \
18gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) += -fplugin-arg-randomize_layout_plugin-performance-mode 25 += -DRANDSTRUCT_PLUGIN
26gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) \
27 += -fplugin-arg-randomize_layout_plugin-performance-mode
19 28
29# All the plugin CFLAGS are collected here in case a build target needs to
30# filter them out of the KBUILD_CFLAGS.
20GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y)) 31GCC_PLUGINS_CFLAGS := $(strip $(addprefix -fplugin=$(objtree)/scripts/gcc-plugins/, $(gcc-plugin-y)) $(gcc-plugin-cflags-y))
21 32# The sancov_plugin.so is included via CFLAGS_KCOV, so it is removed here.
22export GCC_PLUGINS_CFLAGS GCC_PLUGIN GCC_PLUGIN_SUBDIR
23export DISABLE_LATENT_ENTROPY_PLUGIN
24
25# sancov_plugin.so can be only in CFLAGS_KCOV because avoid duplication.
26GCC_PLUGINS_CFLAGS := $(filter-out %/sancov_plugin.so, $(GCC_PLUGINS_CFLAGS)) 33GCC_PLUGINS_CFLAGS := $(filter-out %/sancov_plugin.so, $(GCC_PLUGINS_CFLAGS))
34export GCC_PLUGINS_CFLAGS
27 35
36# Add the flags to the build!
28KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS) 37KBUILD_CFLAGS += $(GCC_PLUGINS_CFLAGS)
38
39# All enabled GCC plugins are collected here for building below.
29GCC_PLUGIN := $(gcc-plugin-y) 40GCC_PLUGIN := $(gcc-plugin-y)
30GCC_PLUGIN_SUBDIR := $(gcc-plugin-subdir-y) 41export GCC_PLUGIN
31 42
32# Actually do the build, if requested. 43# Actually do the build, if requested.
33PHONY += gcc-plugins 44PHONY += gcc-plugins
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index aa971cc3f339..0393f75db4d4 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -62,9 +62,9 @@ host-cxxshobjs := $(addprefix $(obj)/,$(host-cxxshobjs))
62##### 62#####
63# Handle options to gcc. Support building with separate output directory 63# Handle options to gcc. Support building with separate output directory
64 64
65_hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ 65_hostc_flags = $(KBUILD_HOSTCFLAGS) $(HOST_EXTRACFLAGS) \
66 $(HOSTCFLAGS_$(basetarget).o) 66 $(HOSTCFLAGS_$(basetarget).o)
67_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ 67_hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
68 $(HOSTCXXFLAGS_$(basetarget).o) 68 $(HOSTCXXFLAGS_$(basetarget).o)
69 69
70ifeq ($(KBUILD_SRC),) 70ifeq ($(KBUILD_SRC),)
@@ -84,17 +84,17 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
84# Create executable from a single .c file 84# Create executable from a single .c file
85# host-csingle -> Executable 85# host-csingle -> Executable
86quiet_cmd_host-csingle = HOSTCC $@ 86quiet_cmd_host-csingle = HOSTCC $@
87 cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOSTLDFLAGS) -o $@ $< \ 87 cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \
88 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 88 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
89$(host-csingle): $(obj)/%: $(src)/%.c FORCE 89$(host-csingle): $(obj)/%: $(src)/%.c FORCE
90 $(call if_changed_dep,host-csingle) 90 $(call if_changed_dep,host-csingle)
91 91
92# Link an executable based on list of .o files, all plain c 92# Link an executable based on list of .o files, all plain c
93# host-cmulti -> executable 93# host-cmulti -> executable
94quiet_cmd_host-cmulti = HOSTLD $@ 94quiet_cmd_host-cmulti = HOSTLD $@
95 cmd_host-cmulti = $(HOSTCC) $(HOSTLDFLAGS) -o $@ \ 95 cmd_host-cmulti = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ \
96 $(addprefix $(obj)/,$($(@F)-objs)) \ 96 $(addprefix $(obj)/,$($(@F)-objs)) \
97 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 97 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
98$(host-cmulti): FORCE 98$(host-cmulti): FORCE
99 $(call if_changed,host-cmulti) 99 $(call if_changed,host-cmulti)
100$(call multi_depend, $(host-cmulti), , -objs) 100$(call multi_depend, $(host-cmulti), , -objs)
@@ -109,10 +109,10 @@ $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE
109# Link an executable based on list of .o files, a mixture of .c and .cc 109# Link an executable based on list of .o files, a mixture of .c and .cc
110# host-cxxmulti -> executable 110# host-cxxmulti -> executable
111quiet_cmd_host-cxxmulti = HOSTLD $@ 111quiet_cmd_host-cxxmulti = HOSTLD $@
112 cmd_host-cxxmulti = $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \ 112 cmd_host-cxxmulti = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -o $@ \
113 $(foreach o,objs cxxobjs,\ 113 $(foreach o,objs cxxobjs,\
114 $(addprefix $(obj)/,$($(@F)-$(o)))) \ 114 $(addprefix $(obj)/,$($(@F)-$(o)))) \
115 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 115 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
116$(host-cxxmulti): FORCE 116$(host-cxxmulti): FORCE
117 $(call if_changed,host-cxxmulti) 117 $(call if_changed,host-cxxmulti)
118$(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs) 118$(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs)
@@ -143,9 +143,9 @@ $(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE
143# Link a shared library, based on position independent .o files 143# Link a shared library, based on position independent .o files
144# *.o -> .so shared library (host-cshlib) 144# *.o -> .so shared library (host-cshlib)
145quiet_cmd_host-cshlib = HOSTLLD -shared $@ 145quiet_cmd_host-cshlib = HOSTLLD -shared $@
146 cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \ 146 cmd_host-cshlib = $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \
147 $(addprefix $(obj)/,$($(@F:.so=-objs))) \ 147 $(addprefix $(obj)/,$($(@F:.so=-objs))) \
148 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 148 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
149$(host-cshlib): FORCE 149$(host-cshlib): FORCE
150 $(call if_changed,host-cshlib) 150 $(call if_changed,host-cshlib)
151$(call multi_depend, $(host-cshlib), .so, -objs) 151$(call multi_depend, $(host-cshlib), .so, -objs)
@@ -153,9 +153,9 @@ $(call multi_depend, $(host-cshlib), .so, -objs)
153# Link a shared library, based on position independent .o files 153# Link a shared library, based on position independent .o files
154# *.o -> .so shared library (host-cxxshlib) 154# *.o -> .so shared library (host-cxxshlib)
155quiet_cmd_host-cxxshlib = HOSTLLD -shared $@ 155quiet_cmd_host-cxxshlib = HOSTLLD -shared $@
156 cmd_host-cxxshlib = $(HOSTCXX) $(HOSTLDFLAGS) -shared -o $@ \ 156 cmd_host-cxxshlib = $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \
157 $(addprefix $(obj)/,$($(@F:.so=-objs))) \ 157 $(addprefix $(obj)/,$($(@F:.so=-objs))) \
158 $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) 158 $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(@F))
159$(host-cxxshlib): FORCE 159$(host-cxxshlib): FORCE
160 $(call if_changed,host-cxxshlib) 160 $(call if_changed,host-cxxshlib)
161$(call multi_depend, $(host-cxxshlib), .so, -objs) 161$(call multi_depend, $(host-cxxshlib), .so, -objs)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 1bb594fcfe12..61e596650ed3 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -162,7 +162,7 @@ a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
162cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ 162cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
163 $(__cpp_flags) 163 $(__cpp_flags)
164 164
165ld_flags = $(LDFLAGS) $(ldflags-y) 165ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))
166 166
167DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes 167DTC_INCLUDE := $(srctree)/scripts/dtc/include-prefixes
168 168
@@ -225,8 +225,7 @@ $(obj)/%: $(src)/%_shipped
225# --------------------------------------------------------------------------- 225# ---------------------------------------------------------------------------
226 226
227quiet_cmd_ld = LD $@ 227quiet_cmd_ld = LD $@
228cmd_ld = $(LD) $(LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F)) \ 228cmd_ld = $(LD) $(ld_flags) $(filter-out FORCE,$^) -o $@
229 $(filter-out FORCE,$^) -o $@
230 229
231# Objcopy 230# Objcopy
232# --------------------------------------------------------------------------- 231# ---------------------------------------------------------------------------
@@ -416,7 +415,7 @@ define filechk_offsets
416 echo " * This file was generated by Kbuild"; \ 415 echo " * This file was generated by Kbuild"; \
417 echo " */"; \ 416 echo " */"; \
418 echo ""; \ 417 echo ""; \
419 sed -ne $(sed-offsets); \ 418 sed -ne $(sed-offsets) < $<; \
420 echo ""; \ 419 echo ""; \
421 echo "#endif" ) 420 echo "#endif" )
422endef 421endef
diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin
index a763b4775d06..a072a4267746 100644
--- a/scripts/Makefile.modbuiltin
+++ b/scripts/Makefile.modbuiltin
@@ -8,10 +8,10 @@ src := $(obj)
8PHONY := __modbuiltin 8PHONY := __modbuiltin
9__modbuiltin: 9__modbuiltin:
10 10
11-include include/config/auto.conf 11include include/config/auto.conf
12# tristate.conf sets tristate variables to uppercase 'Y' or 'M' 12# tristate.conf sets tristate variables to uppercase 'Y' or 'M'
13# That way, we get the list of built-in modules in obj-Y 13# That way, we get the list of built-in modules in obj-Y
14-include include/config/tristate.conf 14include include/config/tristate.conf
15 15
16include scripts/Kbuild.include 16include scripts/Kbuild.include
17 17
@@ -54,8 +54,4 @@ PHONY += $(subdir-ym)
54$(subdir-ym): 54$(subdir-ym):
55 $(Q)$(MAKE) $(modbuiltin)=$@ 55 $(Q)$(MAKE) $(modbuiltin)=$@
56 56
57
58# Declare the contents of the .PHONY variable as phony. We keep that
59# information in a variable se we can use it in if_changed and friends.
60
61.PHONY: $(PHONY) 57.PHONY: $(PHONY)
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 51ca0244fc8a..ff5ca9817a85 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -35,8 +35,4 @@ modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
35$(modules): 35$(modules):
36 $(call cmd,modules_install,$(MODLIB)/$(modinst_dir)) 36 $(call cmd,modules_install,$(MODLIB)/$(modinst_dir))
37 37
38
39# Declare the contents of the .PHONY variable as phony. We keep that
40# information in a variable so we can use it in if_changed and friends.
41
42.PHONY: $(PHONY) 38.PHONY: $(PHONY)
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index df4174405feb..7d4af0d0accb 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -120,7 +120,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
120# Step 6), final link of the modules with optional arch pass after final link 120# Step 6), final link of the modules with optional arch pass after final link
121quiet_cmd_ld_ko_o = LD [M] $@ 121quiet_cmd_ld_ko_o = LD [M] $@
122 cmd_ld_ko_o = \ 122 cmd_ld_ko_o = \
123 $(LD) -r $(LDFLAGS) \ 123 $(LD) -r $(KBUILD_LDFLAGS) \
124 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ 124 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
125 -o $@ $(filter-out FORCE,$^) ; \ 125 -o $@ $(filter-out FORCE,$^) ; \
126 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) 126 $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
@@ -149,8 +149,4 @@ ifneq ($(cmd_files),)
149 include $(cmd_files) 149 include $(cmd_files)
150endif 150endif
151 151
152
153# Declare the contents of the .PHONY variable as phony. We keep that
154# information in a variable se we can use it in if_changed and friends.
155
156.PHONY: $(PHONY) 152.PHONY: $(PHONY)
diff --git a/scripts/Makefile.modsign b/scripts/Makefile.modsign
index 171483bc0538..da56aa78d245 100644
--- a/scripts/Makefile.modsign
+++ b/scripts/Makefile.modsign
@@ -27,7 +27,4 @@ modinst_dir = $(if $(KBUILD_EXTMOD),$(ext-mod-dir),kernel/$(@D))
27$(modules): 27$(modules):
28 $(call cmd,sign_ko,$(MODLIB)/$(modinst_dir)) 28 $(call cmd,sign_ko,$(MODLIB)/$(modinst_dir))
29 29
30# Declare the contents of the .PHONY variable as phony. We keep that
31# information in a variable se we can use it in if_changed and friends.
32
33.PHONY: $(PHONY) 30.PHONY: $(PHONY)
diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan
index b593b36ccff8..38b2b4818e8e 100644
--- a/scripts/Makefile.ubsan
+++ b/scripts/Makefile.ubsan
@@ -14,10 +14,6 @@ ifdef CONFIG_UBSAN_ALIGNMENT
14 CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment) 14 CFLAGS_UBSAN += $(call cc-option, -fsanitize=alignment)
15endif 15endif
16 16
17ifdef CONFIG_UBSAN_NULL
18 CFLAGS_UBSAN += $(call cc-option, -fsanitize=null)
19endif
20
21 # -fsanitize=* options makes GCC less smart than usual and 17 # -fsanitize=* options makes GCC less smart than usual and
22 # increase number of 'maybe-uninitialized false-positives 18 # increase number of 'maybe-uninitialized false-positives
23 CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized) 19 CFLAGS_UBSAN += $(call cc-option, -Wno-maybe-uninitialized)
diff --git a/scripts/basic/.gitignore b/scripts/basic/.gitignore
index 9528ec9e5adc..a776371a3502 100644
--- a/scripts/basic/.gitignore
+++ b/scripts/basic/.gitignore
@@ -1,2 +1 @@
1fixdep fixdep
2bin2c
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile
index 0372b33febe5..af49b446f17d 100644
--- a/scripts/basic/Makefile
+++ b/scripts/basic/Makefile
@@ -9,7 +9,6 @@
9# fixdep: Used to generate dependency information during build process 9# fixdep: Used to generate dependency information during build process
10 10
11hostprogs-y := fixdep 11hostprogs-y := fixdep
12hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c
13always := $(hostprogs-y) 12always := $(hostprogs-y)
14 13
15# fixdep is needed to compile other host programs 14# fixdep is needed to compile other host programs
diff --git a/scripts/basic/bin2c.c b/scripts/bin2c.c
index c3d7eef3ad06..c3d7eef3ad06 100644
--- a/scripts/basic/bin2c.c
+++ b/scripts/bin2c.c
diff --git a/scripts/cc-can-link.sh b/scripts/cc-can-link.sh
index 208eb2825dab..6efcead31989 100755
--- a/scripts/cc-can-link.sh
+++ b/scripts/cc-can-link.sh
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1 && echo "y" 4cat << "END" | $@ -x c - -o /dev/null >/dev/null 2>&1
5#include <stdio.h> 5#include <stdio.h>
6int main(void) 6int main(void)
7{ 7{
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3b7362b0ee4..5219280bf7ff 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -13,6 +13,7 @@ use POSIX;
13use File::Basename; 13use File::Basename;
14use Cwd 'abs_path'; 14use Cwd 'abs_path';
15use Term::ANSIColor qw(:constants); 15use Term::ANSIColor qw(:constants);
16use Encode qw(decode encode);
16 17
17my $P = $0; 18my $P = $0;
18my $D = dirname(abs_path($P)); 19my $D = dirname(abs_path($P));
@@ -240,11 +241,11 @@ $check_orig = $check;
240 241
241my $exit = 0; 242my $exit = 0;
242 243
244my $perl_version_ok = 1;
243if ($^V && $^V lt $minimum_perl_version) { 245if ($^V && $^V lt $minimum_perl_version) {
246 $perl_version_ok = 0;
244 printf "$P: requires at least perl version %vd\n", $minimum_perl_version; 247 printf "$P: requires at least perl version %vd\n", $minimum_perl_version;
245 if (!$ignore_perl_version) { 248 exit(1) if (!$ignore_perl_version);
246 exit(1);
247 }
248} 249}
249 250
250#if no filenames are given, push '-' to read patch from stdin 251#if no filenames are given, push '-' to read patch from stdin
@@ -346,9 +347,10 @@ our $Sparse = qr{
346 __force| 347 __force|
347 __iomem| 348 __iomem|
348 __must_check| 349 __must_check|
349 __init_refok|
350 __kprobes| 350 __kprobes|
351 __ref| 351 __ref|
352 __refconst|
353 __refdata|
352 __rcu| 354 __rcu|
353 __private 355 __private
354 }x; 356 }x;
@@ -847,6 +849,17 @@ sub is_maintained_obsolete {
847 return $status =~ /obsolete/i; 849 return $status =~ /obsolete/i;
848} 850}
849 851
852sub is_SPDX_License_valid {
853 my ($license) = @_;
854
855 return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py") || !(-e "$root/.git"));
856
857 my $root_path = abs_path($root);
858 my $status = `cd "$root_path"; echo "$license" | python scripts/spdxcheck.py -`;
859 return 0 if ($status ne "");
860 return 1;
861}
862
850my $camelcase_seeded = 0; 863my $camelcase_seeded = 0;
851sub seed_camelcase_includes { 864sub seed_camelcase_includes {
852 return if ($camelcase_seeded); 865 return if ($camelcase_seeded);
@@ -1026,11 +1039,11 @@ if (!$quiet) {
1026 hash_show_words(\%use_type, "Used"); 1039 hash_show_words(\%use_type, "Used");
1027 hash_show_words(\%ignore_type, "Ignored"); 1040 hash_show_words(\%ignore_type, "Ignored");
1028 1041
1029 if ($^V lt 5.10.0) { 1042 if (!$perl_version_ok) {
1030 print << "EOM" 1043 print << "EOM"
1031 1044
1032NOTE: perl $^V is not modern enough to detect all possible issues. 1045NOTE: perl $^V is not modern enough to detect all possible issues.
1033 An upgrade to at least perl v5.10.0 is suggested. 1046 An upgrade to at least perl $minimum_perl_version is suggested.
1034EOM 1047EOM
1035 } 1048 }
1036 if ($exit) { 1049 if ($exit) {
@@ -2235,10 +2248,14 @@ sub process {
2235 2248
2236 our $clean = 1; 2249 our $clean = 1;
2237 my $signoff = 0; 2250 my $signoff = 0;
2251 my $author = '';
2252 my $authorsignoff = 0;
2238 my $is_patch = 0; 2253 my $is_patch = 0;
2254 my $is_binding_patch = -1;
2239 my $in_header_lines = $file ? 0 : 1; 2255 my $in_header_lines = $file ? 0 : 1;
2240 my $in_commit_log = 0; #Scanning lines before patch 2256 my $in_commit_log = 0; #Scanning lines before patch
2241 my $has_commit_log = 0; #Encountered lines before patch 2257 my $has_commit_log = 0; #Encountered lines before patch
2258 my $commit_log_lines = 0; #Number of commit log lines
2242 my $commit_log_possible_stack_dump = 0; 2259 my $commit_log_possible_stack_dump = 0;
2243 my $commit_log_long_line = 0; 2260 my $commit_log_long_line = 0;
2244 my $commit_log_has_diff = 0; 2261 my $commit_log_has_diff = 0;
@@ -2485,6 +2502,19 @@ sub process {
2485 $check = $check_orig; 2502 $check = $check_orig;
2486 } 2503 }
2487 $checklicenseline = 1; 2504 $checklicenseline = 1;
2505
2506 if ($realfile !~ /^MAINTAINERS/) {
2507 my $last_binding_patch = $is_binding_patch;
2508
2509 $is_binding_patch = () = $realfile =~ m@^(?:Documentation/devicetree/|include/dt-bindings/)@;
2510
2511 if (($last_binding_patch != -1) &&
2512 ($last_binding_patch ^ $is_binding_patch)) {
2513 WARN("DT_SPLIT_BINDING_PATCH",
2514 "DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.txt\n");
2515 }
2516 }
2517
2488 next; 2518 next;
2489 } 2519 }
2490 2520
@@ -2496,6 +2526,18 @@ sub process {
2496 2526
2497 $cnt_lines++ if ($realcnt != 0); 2527 $cnt_lines++ if ($realcnt != 0);
2498 2528
2529# Verify the existence of a commit log if appropriate
2530# 2 is used because a $signature is counted in $commit_log_lines
2531 if ($in_commit_log) {
2532 if ($line !~ /^\s*$/) {
2533 $commit_log_lines++; #could be a $signature
2534 }
2535 } elsif ($has_commit_log && $commit_log_lines < 2) {
2536 WARN("COMMIT_MESSAGE",
2537 "Missing commit description - Add an appropriate one\n");
2538 $commit_log_lines = 2; #warn only once
2539 }
2540
2499# Check if the commit log has what seems like a diff which can confuse patch 2541# Check if the commit log has what seems like a diff which can confuse patch
2500 if ($in_commit_log && !$commit_log_has_diff && 2542 if ($in_commit_log && !$commit_log_has_diff &&
2501 (($line =~ m@^\s+diff\b.*a/[\w/]+@ && 2543 (($line =~ m@^\s+diff\b.*a/[\w/]+@ &&
@@ -2517,10 +2559,24 @@ sub process {
2517 } 2559 }
2518 } 2560 }
2519 2561
2562# Check the patch for a From:
2563 if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
2564 $author = $1;
2565 $author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
2566 $author =~ s/"//g;
2567 }
2568
2520# Check the patch for a signoff: 2569# Check the patch for a signoff:
2521 if ($line =~ /^\s*signed-off-by:/i) { 2570 if ($line =~ /^\s*signed-off-by:/i) {
2522 $signoff++; 2571 $signoff++;
2523 $in_commit_log = 0; 2572 $in_commit_log = 0;
2573 if ($author ne '') {
2574 my $l = $line;
2575 $l =~ s/"//g;
2576 if ($l =~ /^\s*signed-off-by:\s*\Q$author\E/i) {
2577 $authorsignoff = 1;
2578 }
2579 }
2524 } 2580 }
2525 2581
2526# Check if MAINTAINERS is being updated. If so, there's probably no need to 2582# Check if MAINTAINERS is being updated. If so, there's probably no need to
@@ -2606,12 +2662,6 @@ sub process {
2606 "A patch subject line should describe the change not the tool that found it\n" . $herecurr); 2662 "A patch subject line should describe the change not the tool that found it\n" . $herecurr);
2607 } 2663 }
2608 2664
2609# Check for old stable address
2610 if ($line =~ /^\s*cc:\s*.*<?\bstable\@kernel\.org\b>?.*$/i) {
2611 ERROR("STABLE_ADDRESS",
2612 "The 'stable' address should be 'stable\@vger.kernel.org'\n" . $herecurr);
2613 }
2614
2615# Check for unwanted Gerrit info 2665# Check for unwanted Gerrit info
2616 if ($in_commit_log && $line =~ /^\s*change-id:/i) { 2666 if ($in_commit_log && $line =~ /^\s*change-id:/i) {
2617 ERROR("GERRIT_CHANGE_ID", 2667 ERROR("GERRIT_CHANGE_ID",
@@ -2966,8 +3016,14 @@ sub process {
2966 3016
2967 if ($comment !~ /^$/ && 3017 if ($comment !~ /^$/ &&
2968 $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) { 3018 $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) {
2969 WARN("SPDX_LICENSE_TAG", 3019 WARN("SPDX_LICENSE_TAG",
2970 "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr); 3020 "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
3021 } elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) {
3022 my $spdx_license = $1;
3023 if (!is_SPDX_License_valid($spdx_license)) {
3024 WARN("SPDX_LICENSE_TAG",
3025 "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
3026 }
2971 } 3027 }
2972 } 3028 }
2973 } 3029 }
@@ -3085,7 +3141,7 @@ sub process {
3085 } 3141 }
3086 3142
3087# check indentation starts on a tab stop 3143# check indentation starts on a tab stop
3088 if ($^V && $^V ge 5.10.0 && 3144 if ($perl_version_ok &&
3089 $sline =~ /^\+\t+( +)(?:$c90_Keywords\b|\{\s*$|\}\s*(?:else\b|while\b|\s*$)|$Declare\s*$Ident\s*[;=])/) { 3145 $sline =~ /^\+\t+( +)(?:$c90_Keywords\b|\{\s*$|\}\s*(?:else\b|while\b|\s*$)|$Declare\s*$Ident\s*[;=])/) {
3090 my $indent = length($1); 3146 my $indent = length($1);
3091 if ($indent % 8) { 3147 if ($indent % 8) {
@@ -3098,7 +3154,7 @@ sub process {
3098 } 3154 }
3099 3155
3100# check multi-line statement indentation matches previous line 3156# check multi-line statement indentation matches previous line
3101 if ($^V && $^V ge 5.10.0 && 3157 if ($perl_version_ok &&
3102 $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) { 3158 $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) {
3103 $prevline =~ /^\+(\t*)(.*)$/; 3159 $prevline =~ /^\+(\t*)(.*)$/;
3104 my $oldindent = $1; 3160 my $oldindent = $1;
@@ -3787,6 +3843,26 @@ sub process {
3787 "type '$tmp' should be specified in [[un]signed] [short|int|long|long long] order\n" . $herecurr); 3843 "type '$tmp' should be specified in [[un]signed] [short|int|long|long long] order\n" . $herecurr);
3788 } 3844 }
3789 3845
3846# check for unnecessary <signed> int declarations of short/long/long long
3847 while ($sline =~ m{\b($TypeMisordered(\s*\*)*|$C90_int_types)\b}g) {
3848 my $type = trim($1);
3849 next if ($type !~ /\bint\b/);
3850 next if ($type !~ /\b(?:short|long\s+long|long)\b/);
3851 my $new_type = $type;
3852 $new_type =~ s/\b\s*int\s*\b/ /;
3853 $new_type =~ s/\b\s*(?:un)?signed\b\s*/ /;
3854 $new_type =~ s/^const\s+//;
3855 $new_type = "unsigned $new_type" if ($type =~ /\bunsigned\b/);
3856 $new_type = "const $new_type" if ($type =~ /^const\b/);
3857 $new_type =~ s/\s+/ /g;
3858 $new_type = trim($new_type);
3859 if (WARN("UNNECESSARY_INT",
3860 "Prefer '$new_type' over '$type' as the int is unnecessary\n" . $herecurr) &&
3861 $fix) {
3862 $fixed[$fixlinenr] =~ s/\b\Q$type\E\b/$new_type/;
3863 }
3864 }
3865
3790# check for static const char * arrays. 3866# check for static const char * arrays.
3791 if ($line =~ /\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*/) { 3867 if ($line =~ /\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*/) {
3792 WARN("STATIC_CONST_CHAR_ARRAY", 3868 WARN("STATIC_CONST_CHAR_ARRAY",
@@ -3973,7 +4049,7 @@ sub process {
3973 4049
3974# function brace can't be on same line, except for #defines of do while, 4050# function brace can't be on same line, except for #defines of do while,
3975# or if closed on same line 4051# or if closed on same line
3976 if ($^V && $^V ge 5.10.0 && 4052 if ($perl_version_ok &&
3977 $sline =~ /$Type\s*$Ident\s*$balanced_parens\s*\{/ && 4053 $sline =~ /$Type\s*$Ident\s*$balanced_parens\s*\{/ &&
3978 $sline !~ /\#\s*define\b.*do\s*\{/ && 4054 $sline !~ /\#\s*define\b.*do\s*\{/ &&
3979 $sline !~ /}/) { 4055 $sline !~ /}/) {
@@ -4489,11 +4565,11 @@ sub process {
4489 4565
4490#need space before brace following if, while, etc 4566#need space before brace following if, while, etc
4491 if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) || 4567 if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
4492 $line =~ /do\{/) { 4568 $line =~ /\b(?:else|do)\{/) {
4493 if (ERROR("SPACING", 4569 if (ERROR("SPACING",
4494 "space required before the open brace '{'\n" . $herecurr) && 4570 "space required before the open brace '{'\n" . $herecurr) &&
4495 $fix) { 4571 $fix) {
4496 $fixed[$fixlinenr] =~ s/^(\+.*(?:do|\)))\{/$1 {/; 4572 $fixed[$fixlinenr] =~ s/^(\+.*(?:do|else|\)))\{/$1 {/;
4497 } 4573 }
4498 } 4574 }
4499 4575
@@ -4584,7 +4660,7 @@ sub process {
4584# check for unnecessary parentheses around comparisons in if uses 4660# check for unnecessary parentheses around comparisons in if uses
4585# when !drivers/staging or command-line uses --strict 4661# when !drivers/staging or command-line uses --strict
4586 if (($realfile !~ m@^(?:drivers/staging/)@ || $check_orig) && 4662 if (($realfile !~ m@^(?:drivers/staging/)@ || $check_orig) &&
4587 $^V && $^V ge 5.10.0 && defined($stat) && 4663 $perl_version_ok && defined($stat) &&
4588 $stat =~ /(^.\s*if\s*($balanced_parens))/) { 4664 $stat =~ /(^.\s*if\s*($balanced_parens))/) {
4589 my $if_stat = $1; 4665 my $if_stat = $1;
4590 my $test = substr($2, 1, -1); 4666 my $test = substr($2, 1, -1);
@@ -4621,7 +4697,7 @@ sub process {
4621# return is not a function 4697# return is not a function
4622 if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) { 4698 if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) {
4623 my $spacing = $1; 4699 my $spacing = $1;
4624 if ($^V && $^V ge 5.10.0 && 4700 if ($perl_version_ok &&
4625 $stat =~ /^.\s*return\s*($balanced_parens)\s*;\s*$/) { 4701 $stat =~ /^.\s*return\s*($balanced_parens)\s*;\s*$/) {
4626 my $value = $1; 4702 my $value = $1;
4627 $value = deparenthesize($value); 4703 $value = deparenthesize($value);
@@ -4648,7 +4724,7 @@ sub process {
4648 } 4724 }
4649 4725
4650# if statements using unnecessary parentheses - ie: if ((foo == bar)) 4726# if statements using unnecessary parentheses - ie: if ((foo == bar))
4651 if ($^V && $^V ge 5.10.0 && 4727 if ($perl_version_ok &&
4652 $line =~ /\bif\s*((?:\(\s*){2,})/) { 4728 $line =~ /\bif\s*((?:\(\s*){2,})/) {
4653 my $openparens = $1; 4729 my $openparens = $1;
4654 my $count = $openparens =~ tr@\(@\(@; 4730 my $count = $openparens =~ tr@\(@\(@;
@@ -4665,7 +4741,7 @@ sub process {
4665# avoid cases like "foo + BAR < baz" 4741# avoid cases like "foo + BAR < baz"
4666# only fix matches surrounded by parentheses to avoid incorrect 4742# only fix matches surrounded by parentheses to avoid incorrect
4667# conversions like "FOO < baz() + 5" being "misfixed" to "baz() > FOO + 5" 4743# conversions like "FOO < baz() + 5" being "misfixed" to "baz() > FOO + 5"
4668 if ($^V && $^V ge 5.10.0 && 4744 if ($perl_version_ok &&
4669 $line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) { 4745 $line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) {
4670 my $lead = $1; 4746 my $lead = $1;
4671 my $const = $2; 4747 my $const = $2;
@@ -4955,6 +5031,7 @@ sub process {
4955 if (defined $define_args && $define_args ne "") { 5031 if (defined $define_args && $define_args ne "") {
4956 $define_args = substr($define_args, 1, length($define_args) - 2); 5032 $define_args = substr($define_args, 1, length($define_args) - 2);
4957 $define_args =~ s/\s*//g; 5033 $define_args =~ s/\s*//g;
5034 $define_args =~ s/\\\+?//g;
4958 @def_args = split(",", $define_args); 5035 @def_args = split(",", $define_args);
4959 } 5036 }
4960 5037
@@ -5090,7 +5167,7 @@ sub process {
5090# do {} while (0) macro tests: 5167# do {} while (0) macro tests:
5091# single-statement macros do not need to be enclosed in do while (0) loop, 5168# single-statement macros do not need to be enclosed in do while (0) loop,
5092# macro should not end with a semicolon 5169# macro should not end with a semicolon
5093 if ($^V && $^V ge 5.10.0 && 5170 if ($perl_version_ok &&
5094 $realfile !~ m@/vmlinux.lds.h$@ && 5171 $realfile !~ m@/vmlinux.lds.h$@ &&
5095 $line =~ /^.\s*\#\s*define\s+$Ident(\()?/) { 5172 $line =~ /^.\s*\#\s*define\s+$Ident(\()?/) {
5096 my $ln = $linenr; 5173 my $ln = $linenr;
@@ -5336,15 +5413,28 @@ sub process {
5336 } 5413 }
5337 5414
5338# concatenated string without spaces between elements 5415# concatenated string without spaces between elements
5339 if ($line =~ /$String[A-Z_]/ || $line =~ /[A-Za-z0-9_]$String/) { 5416 if ($line =~ /$String[A-Za-z0-9_]/ || $line =~ /[A-Za-z0-9_]$String/) {
5340 CHK("CONCATENATED_STRING", 5417 if (CHK("CONCATENATED_STRING",
5341 "Concatenated strings should use spaces between elements\n" . $herecurr); 5418 "Concatenated strings should use spaces between elements\n" . $herecurr) &&
5419 $fix) {
5420 while ($line =~ /($String)/g) {
5421 my $extracted_string = substr($rawline, $-[0], $+[0] - $-[0]);
5422 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E([A-Za-z0-9_])/$extracted_string $1/;
5423 $fixed[$fixlinenr] =~ s/([A-Za-z0-9_])\Q$extracted_string\E/$1 $extracted_string/;
5424 }
5425 }
5342 } 5426 }
5343 5427
5344# uncoalesced string fragments 5428# uncoalesced string fragments
5345 if ($line =~ /$String\s*"/) { 5429 if ($line =~ /$String\s*"/) {
5346 WARN("STRING_FRAGMENTS", 5430 if (WARN("STRING_FRAGMENTS",
5347 "Consecutive strings are generally better as a single string\n" . $herecurr); 5431 "Consecutive strings are generally better as a single string\n" . $herecurr) &&
5432 $fix) {
5433 while ($line =~ /($String)(?=\s*")/g) {
5434 my $extracted_string = substr($rawline, $-[0], $+[0] - $-[0]);
5435 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E\s*"/substr($extracted_string, 0, -1)/e;
5436 }
5437 }
5348 } 5438 }
5349 5439
5350# check for non-standard and hex prefixed decimal printf formats 5440# check for non-standard and hex prefixed decimal printf formats
@@ -5380,9 +5470,14 @@ sub process {
5380 5470
5381# warn about #if 0 5471# warn about #if 0
5382 if ($line =~ /^.\s*\#\s*if\s+0\b/) { 5472 if ($line =~ /^.\s*\#\s*if\s+0\b/) {
5383 CHK("REDUNDANT_CODE", 5473 WARN("IF_0",
5384 "if this code is redundant consider removing it\n" . 5474 "Consider removing the code enclosed by this #if 0 and its #endif\n" . $herecurr);
5385 $herecurr); 5475 }
5476
5477# warn about #if 1
5478 if ($line =~ /^.\s*\#\s*if\s+1\b/) {
5479 WARN("IF_1",
5480 "Consider removing the #if 1 and its #endif\n" . $herecurr);
5386 } 5481 }
5387 5482
5388# check for needless "if (<foo>) fn(<foo>)" uses 5483# check for needless "if (<foo>) fn(<foo>)" uses
@@ -5453,7 +5548,7 @@ sub process {
5453 } 5548 }
5454 5549
5455# check for mask then right shift without a parentheses 5550# check for mask then right shift without a parentheses
5456 if ($^V && $^V ge 5.10.0 && 5551 if ($perl_version_ok &&
5457 $line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ && 5552 $line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ &&
5458 $4 !~ /^\&/) { # $LvalOrFunc may be &foo, ignore if so 5553 $4 !~ /^\&/) { # $LvalOrFunc may be &foo, ignore if so
5459 WARN("MASK_THEN_SHIFT", 5554 WARN("MASK_THEN_SHIFT",
@@ -5461,7 +5556,7 @@ sub process {
5461 } 5556 }
5462 5557
5463# check for pointer comparisons to NULL 5558# check for pointer comparisons to NULL
5464 if ($^V && $^V ge 5.10.0) { 5559 if ($perl_version_ok) {
5465 while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) { 5560 while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) {
5466 my $val = $1; 5561 my $val = $1;
5467 my $equal = "!"; 5562 my $equal = "!";
@@ -5733,7 +5828,7 @@ sub process {
5733 } 5828 }
5734 5829
5735# Check for __attribute__ weak, or __weak declarations (may have link issues) 5830# Check for __attribute__ weak, or __weak declarations (may have link issues)
5736 if ($^V && $^V ge 5.10.0 && 5831 if ($perl_version_ok &&
5737 $line =~ /(?:$Declare|$DeclareMisordered)\s*$Ident\s*$balanced_parens\s*(?:$Attribute)?\s*;/ && 5832 $line =~ /(?:$Declare|$DeclareMisordered)\s*$Ident\s*$balanced_parens\s*(?:$Attribute)?\s*;/ &&
5738 ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ || 5833 ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ ||
5739 $line =~ /\b__weak\b/)) { 5834 $line =~ /\b__weak\b/)) {
@@ -5815,18 +5910,18 @@ sub process {
5815 } 5910 }
5816 5911
5817# check for vsprintf extension %p<foo> misuses 5912# check for vsprintf extension %p<foo> misuses
5818 if ($^V && $^V ge 5.10.0 && 5913 if ($perl_version_ok &&
5819 defined $stat && 5914 defined $stat &&
5820 $stat =~ /^\+(?![^\{]*\{\s*).*\b(\w+)\s*\(.*$String\s*,/s && 5915 $stat =~ /^\+(?![^\{]*\{\s*).*\b(\w+)\s*\(.*$String\s*,/s &&
5821 $1 !~ /^_*volatile_*$/) { 5916 $1 !~ /^_*volatile_*$/) {
5822 my $specifier;
5823 my $extension;
5824 my $bad_specifier = "";
5825 my $stat_real; 5917 my $stat_real;
5826 5918
5827 my $lc = $stat =~ tr@\n@@; 5919 my $lc = $stat =~ tr@\n@@;
5828 $lc = $lc + $linenr; 5920 $lc = $lc + $linenr;
5829 for (my $count = $linenr; $count <= $lc; $count++) { 5921 for (my $count = $linenr; $count <= $lc; $count++) {
5922 my $specifier;
5923 my $extension;
5924 my $bad_specifier = "";
5830 my $fmt = get_quoted_string($lines[$count - 1], raw_line($count, 0)); 5925 my $fmt = get_quoted_string($lines[$count - 1], raw_line($count, 0));
5831 $fmt =~ s/%%//g; 5926 $fmt =~ s/%%//g;
5832 5927
@@ -5862,7 +5957,7 @@ sub process {
5862 } 5957 }
5863 5958
5864# Check for misused memsets 5959# Check for misused memsets
5865 if ($^V && $^V ge 5.10.0 && 5960 if ($perl_version_ok &&
5866 defined $stat && 5961 defined $stat &&
5867 $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/) { 5962 $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/) {
5868 5963
@@ -5880,7 +5975,7 @@ sub process {
5880 } 5975 }
5881 5976
5882# Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar) 5977# Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar)
5883# if ($^V && $^V ge 5.10.0 && 5978# if ($perl_version_ok &&
5884# defined $stat && 5979# defined $stat &&
5885# $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { 5980# $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5886# if (WARN("PREFER_ETHER_ADDR_COPY", 5981# if (WARN("PREFER_ETHER_ADDR_COPY",
@@ -5891,7 +5986,7 @@ sub process {
5891# } 5986# }
5892 5987
5893# Check for memcmp(foo, bar, ETH_ALEN) that could be ether_addr_equal*(foo, bar) 5988# Check for memcmp(foo, bar, ETH_ALEN) that could be ether_addr_equal*(foo, bar)
5894# if ($^V && $^V ge 5.10.0 && 5989# if ($perl_version_ok &&
5895# defined $stat && 5990# defined $stat &&
5896# $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { 5991# $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5897# WARN("PREFER_ETHER_ADDR_EQUAL", 5992# WARN("PREFER_ETHER_ADDR_EQUAL",
@@ -5900,7 +5995,7 @@ sub process {
5900 5995
5901# check for memset(foo, 0x0, ETH_ALEN) that could be eth_zero_addr 5996# check for memset(foo, 0x0, ETH_ALEN) that could be eth_zero_addr
5902# check for memset(foo, 0xFF, ETH_ALEN) that could be eth_broadcast_addr 5997# check for memset(foo, 0xFF, ETH_ALEN) that could be eth_broadcast_addr
5903# if ($^V && $^V ge 5.10.0 && 5998# if ($perl_version_ok &&
5904# defined $stat && 5999# defined $stat &&
5905# $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) { 6000# $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
5906# 6001#
@@ -5922,7 +6017,7 @@ sub process {
5922# } 6017# }
5923 6018
5924# typecasts on min/max could be min_t/max_t 6019# typecasts on min/max could be min_t/max_t
5925 if ($^V && $^V ge 5.10.0 && 6020 if ($perl_version_ok &&
5926 defined $stat && 6021 defined $stat &&
5927 $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) { 6022 $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
5928 if (defined $2 || defined $7) { 6023 if (defined $2 || defined $7) {
@@ -5946,7 +6041,7 @@ sub process {
5946 } 6041 }
5947 6042
5948# check usleep_range arguments 6043# check usleep_range arguments
5949 if ($^V && $^V ge 5.10.0 && 6044 if ($perl_version_ok &&
5950 defined $stat && 6045 defined $stat &&
5951 $stat =~ /^\+(?:.*?)\busleep_range\s*\(\s*($FuncArg)\s*,\s*($FuncArg)\s*\)/) { 6046 $stat =~ /^\+(?:.*?)\busleep_range\s*\(\s*($FuncArg)\s*,\s*($FuncArg)\s*\)/) {
5952 my $min = $1; 6047 my $min = $1;
@@ -5962,7 +6057,7 @@ sub process {
5962 } 6057 }
5963 6058
5964# check for naked sscanf 6059# check for naked sscanf
5965 if ($^V && $^V ge 5.10.0 && 6060 if ($perl_version_ok &&
5966 defined $stat && 6061 defined $stat &&
5967 $line =~ /\bsscanf\b/ && 6062 $line =~ /\bsscanf\b/ &&
5968 ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ && 6063 ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ &&
@@ -5976,7 +6071,7 @@ sub process {
5976 } 6071 }
5977 6072
5978# check for simple sscanf that should be kstrto<foo> 6073# check for simple sscanf that should be kstrto<foo>
5979 if ($^V && $^V ge 5.10.0 && 6074 if ($perl_version_ok &&
5980 defined $stat && 6075 defined $stat &&
5981 $line =~ /\bsscanf\b/) { 6076 $line =~ /\bsscanf\b/) {
5982 my $lc = $stat =~ tr@\n@@; 6077 my $lc = $stat =~ tr@\n@@;
@@ -6048,7 +6143,7 @@ sub process {
6048 } 6143 }
6049 6144
6050# check for function definitions 6145# check for function definitions
6051 if ($^V && $^V ge 5.10.0 && 6146 if ($perl_version_ok &&
6052 defined $stat && 6147 defined $stat &&
6053 $stat =~ /^.\s*(?:$Storage\s+)?$Type\s*($Ident)\s*$balanced_parens\s*{/s) { 6148 $stat =~ /^.\s*(?:$Storage\s+)?$Type\s*($Ident)\s*$balanced_parens\s*{/s) {
6054 $context_function = $1; 6149 $context_function = $1;
@@ -6088,14 +6183,14 @@ sub process {
6088 6183
6089# alloc style 6184# alloc style
6090# p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...) 6185# p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...)
6091 if ($^V && $^V ge 5.10.0 && 6186 if ($perl_version_ok &&
6092 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*([kv][mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) { 6187 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*([kv][mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) {
6093 CHK("ALLOC_SIZEOF_STRUCT", 6188 CHK("ALLOC_SIZEOF_STRUCT",
6094 "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr); 6189 "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr);
6095 } 6190 }
6096 6191
6097# check for k[mz]alloc with multiplies that could be kmalloc_array/kcalloc 6192# check for k[mz]alloc with multiplies that could be kmalloc_array/kcalloc
6098 if ($^V && $^V ge 5.10.0 && 6193 if ($perl_version_ok &&
6099 defined $stat && 6194 defined $stat &&
6100 $stat =~ /^\+\s*($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*\*\s*($FuncArg)\s*,/) { 6195 $stat =~ /^\+\s*($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*\*\s*($FuncArg)\s*,/) {
6101 my $oldfunc = $3; 6196 my $oldfunc = $3;
@@ -6124,8 +6219,9 @@ sub process {
6124 } 6219 }
6125 6220
6126# check for krealloc arg reuse 6221# check for krealloc arg reuse
6127 if ($^V && $^V ge 5.10.0 && 6222 if ($perl_version_ok &&
6128 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) { 6223 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*($Lval)\s*,/ &&
6224 $1 eq $3) {
6129 WARN("KREALLOC_ARG_REUSE", 6225 WARN("KREALLOC_ARG_REUSE",
6130 "Reusing the krealloc arg is almost always a bug\n" . $herecurr); 6226 "Reusing the krealloc arg is almost always a bug\n" . $herecurr);
6131 } 6227 }
@@ -6193,7 +6289,7 @@ sub process {
6193 } 6289 }
6194 6290
6195# check for switch/default statements without a break; 6291# check for switch/default statements without a break;
6196 if ($^V && $^V ge 5.10.0 && 6292 if ($perl_version_ok &&
6197 defined $stat && 6293 defined $stat &&
6198 $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) { 6294 $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) {
6199 my $cnt = statement_rawlines($stat); 6295 my $cnt = statement_rawlines($stat);
@@ -6257,6 +6353,13 @@ sub process {
6257 "Avoid using bool as bitfield. Prefer bool bitfields as unsigned int or u<8|16|32>\n" . $herecurr); 6353 "Avoid using bool as bitfield. Prefer bool bitfields as unsigned int or u<8|16|32>\n" . $herecurr);
6258 } 6354 }
6259 6355
6356# check for bool use in .h files
6357 if ($realfile =~ /\.h$/ &&
6358 $sline =~ /^.\s+bool\s*$Ident\s*(?::\s*d+\s*)?;/) {
6359 CHK("BOOL_MEMBER",
6360 "Avoid using bool structure members because of possible alignment issues - see: https://lkml.org/lkml/2017/11/21/384\n" . $herecurr);
6361 }
6362
6260# check for semaphores initialized locked 6363# check for semaphores initialized locked
6261 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { 6364 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
6262 WARN("CONSIDER_COMPLETION", 6365 WARN("CONSIDER_COMPLETION",
@@ -6303,7 +6406,7 @@ sub process {
6303 } 6406 }
6304 6407
6305# likely/unlikely comparisons similar to "(likely(foo) > 0)" 6408# likely/unlikely comparisons similar to "(likely(foo) > 0)"
6306 if ($^V && $^V ge 5.10.0 && 6409 if ($perl_version_ok &&
6307 $line =~ /\b((?:un)?likely)\s*\(\s*$FuncArg\s*\)\s*$Compare/) { 6410 $line =~ /\b((?:un)?likely)\s*\(\s*$FuncArg\s*\)\s*$Compare/) {
6308 WARN("LIKELY_MISUSE", 6411 WARN("LIKELY_MISUSE",
6309 "Using $1 should generally have parentheses around the comparison\n" . $herecurr); 6412 "Using $1 should generally have parentheses around the comparison\n" . $herecurr);
@@ -6346,7 +6449,7 @@ sub process {
6346# check for DEVICE_ATTR uses that could be DEVICE_ATTR_<FOO> 6449# check for DEVICE_ATTR uses that could be DEVICE_ATTR_<FOO>
6347# and whether or not function naming is typical and if 6450# and whether or not function naming is typical and if
6348# DEVICE_ATTR permissions uses are unusual too 6451# DEVICE_ATTR permissions uses are unusual too
6349 if ($^V && $^V ge 5.10.0 && 6452 if ($perl_version_ok &&
6350 defined $stat && 6453 defined $stat &&
6351 $stat =~ /\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?\s*(\s*(?:${multi_mode_perms_string_search}|0[0-7]{3,3})\s*)\s*\)?\s*,\s*(\w+)\s*,\s*(\w+)\s*\)/) { 6454 $stat =~ /\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?\s*(\s*(?:${multi_mode_perms_string_search}|0[0-7]{3,3})\s*)\s*\)?\s*,\s*(\w+)\s*,\s*(\w+)\s*\)/) {
6352 my $var = $1; 6455 my $var = $1;
@@ -6406,7 +6509,7 @@ sub process {
6406# specific definition of not visible in sysfs. 6509# specific definition of not visible in sysfs.
6407# o Ignore proc_create*(...) uses with a decimal 0 permission as that means 6510# o Ignore proc_create*(...) uses with a decimal 0 permission as that means
6408# use the default permissions 6511# use the default permissions
6409 if ($^V && $^V ge 5.10.0 && 6512 if ($perl_version_ok &&
6410 defined $stat && 6513 defined $stat &&
6411 $line =~ /$mode_perms_search/) { 6514 $line =~ /$mode_perms_search/) {
6412 foreach my $entry (@mode_permission_funcs) { 6515 foreach my $entry (@mode_permission_funcs) {
@@ -6492,9 +6595,14 @@ sub process {
6492 ERROR("NOT_UNIFIED_DIFF", 6595 ERROR("NOT_UNIFIED_DIFF",
6493 "Does not appear to be a unified-diff format patch\n"); 6596 "Does not appear to be a unified-diff format patch\n");
6494 } 6597 }
6495 if ($is_patch && $has_commit_log && $chk_signoff && $signoff == 0) { 6598 if ($is_patch && $has_commit_log && $chk_signoff) {
6496 ERROR("MISSING_SIGN_OFF", 6599 if ($signoff == 0) {
6497 "Missing Signed-off-by: line(s)\n"); 6600 ERROR("MISSING_SIGN_OFF",
6601 "Missing Signed-off-by: line(s)\n");
6602 } elsif (!$authorsignoff) {
6603 WARN("NO_AUTHOR_SIGN_OFF",
6604 "Missing Signed-off-by: line by nominal patch author '$author'\n");
6605 }
6498 } 6606 }
6499 6607
6500 print report_dump(); 6608 print report_dump();
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index cbdf0dfd4c22..8081b6cf67d2 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -15,6 +15,7 @@
15# M68k port by Geert Uytterhoeven and Andreas Schwab 15# M68k port by Geert Uytterhoeven and Andreas Schwab
16# AArch64, PARISC ports by Kyle McMartin 16# AArch64, PARISC ports by Kyle McMartin
17# sparc port by Martin Habets <errandir_news@mph.eclipse.co.uk> 17# sparc port by Martin Habets <errandir_news@mph.eclipse.co.uk>
18# ppc64le port by Breno Leitao <leitao@debian.org>
18# 19#
19# Usage: 20# Usage:
20# objdump -d vmlinux | scripts/checkstack.pl [arch] 21# objdump -d vmlinux | scripts/checkstack.pl [arch]
@@ -78,13 +79,9 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
78 $re = qr/.*l\.addi.*r1,r1,-(([0-9]{2}|[3-9])[0-9]{2})/o; 79 $re = qr/.*l\.addi.*r1,r1,-(([0-9]{2}|[3-9])[0-9]{2})/o;
79 } elsif ($arch eq 'parisc' || $arch eq 'parisc64') { 80 } elsif ($arch eq 'parisc' || $arch eq 'parisc64') {
80 $re = qr/.*ldo ($x{1,8})\(sp\),sp/o; 81 $re = qr/.*ldo ($x{1,8})\(sp\),sp/o;
81 } elsif ($arch eq 'ppc') { 82 } elsif ($arch eq 'powerpc' || $arch =~ /^ppc(64)?(le)?$/ ) {
82 #c00029f4: 94 21 ff 30 stwu r1,-208(r1) 83 # powerpc : 94 21 ff 30 stwu r1,-208(r1)
83 $re = qr/.*stwu.*r1,-($x{1,8})\(r1\)/o; 84 # ppc64(le) : 81 ff 21 f8 stdu r1,-128(r1)
84 } elsif ($arch eq 'ppc64') {
85 #XXX
86 $re = qr/.*stdu.*r1,-($x{1,8})\(r1\)/o;
87 } elsif ($arch eq 'powerpc') {
88 $re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o; 85 $re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o;
89 } elsif ($arch =~ /^s390x?$/) { 86 } elsif ($arch =~ /^s390x?$/) {
90 # 11160: a7 fb ff 60 aghi %r15,-160 87 # 11160: a7 fb ff 60 aghi %r15,-160
diff --git a/scripts/clang-version.sh b/scripts/clang-version.sh
index dbf0a31eb111..e65fbc3079d4 100755
--- a/scripts/clang-version.sh
+++ b/scripts/clang-version.sh
@@ -12,7 +12,7 @@
12 12
13compiler="$*" 13compiler="$*"
14 14
15if !( $compiler --version | grep -q clang) ; then 15if ! ( $compiler --version | grep -q clang) ; then
16 echo 0 16 echo 0
17 exit 1 17 exit 1
18fi 18fi
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 9fedca611b7f..e04d328210ac 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -128,9 +128,10 @@ run_cmd_parmap() {
128 fi 128 fi
129 echo $@ >>$DEBUG_FILE 129 echo $@ >>$DEBUG_FILE
130 $@ 2>>$DEBUG_FILE 130 $@ 2>>$DEBUG_FILE
131 if [[ $? -ne 0 ]]; then 131 err=$?
132 if [[ $err -ne 0 ]]; then
132 echo "coccicheck failed" 133 echo "coccicheck failed"
133 exit $? 134 exit $err
134 fi 135 fi
135} 136}
136 137
diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
index 92b20913055f..d819275b7fde 100644
--- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci
+++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci
@@ -35,8 +35,7 @@ statement S;
35 35
36* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\| 36* x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\|
37 kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\| 37 kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\|
38 devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\| 38 devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|kvmalloc_node(E1,...)\);
39 kvmalloc_node(E1,...)\);
40 if ((x==NULL) || ...) S 39 if ((x==NULL) || ...) S
41* memset((T2)x,0,E1); 40* memset((T2)x,0,E1);
42 41
@@ -124,15 +123,6 @@ statement S;
124- x = (T)kvmalloc(E1,E2); 123- x = (T)kvmalloc(E1,E2);
125+ x = (T)kvzalloc(E1,E2); 124+ x = (T)kvzalloc(E1,E2);
126| 125|
127- x = pci_alloc_consistent(E2,E1,E3);
128+ x = pci_zalloc_consistent(E2,E1,E3);
129|
130- x = (T *)pci_alloc_consistent(E2,E1,E3);
131+ x = pci_zalloc_consistent(E2,E1,E3);
132|
133- x = (T)pci_alloc_consistent(E2,E1,E3);
134+ x = (T)pci_zalloc_consistent(E2,E1,E3);
135|
136- x = kvmalloc_node(E1,E2,E3); 126- x = kvmalloc_node(E1,E2,E3);
137+ x = kvzalloc_node(E1,E2,E3); 127+ x = kvzalloc_node(E1,E2,E3);
138| 128|
@@ -389,35 +379,6 @@ msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x)
389coccilib.report.print_report(p[0], msg) 379coccilib.report.print_report(p[0], msg)
390 380
391//----------------------------------------------------------------- 381//-----------------------------------------------------------------
392@r8 depends on org || report@
393type T, T2;
394expression x;
395expression E1,E2,E3;
396statement S;
397position p;
398@@
399
400 x = (T)pci_alloc_consistent@p(E2,E1,E3);
401 if ((x==NULL) || ...) S
402 memset((T2)x,0,E1);
403
404@script:python depends on org@
405p << r8.p;
406x << r8.x;
407@@
408
409msg="%s" % (x)
410msg_safe=msg.replace("[","@(").replace("]",")")
411coccilib.org.print_todo(p[0], msg_safe)
412
413@script:python depends on report@
414p << r8.p;
415x << r8.x;
416@@
417
418msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x)
419coccilib.report.print_report(p[0], msg)
420//-----------------------------------------------------------------
421@r9 depends on org || report@ 382@r9 depends on org || report@
422type T, T2; 383type T, T2;
423expression x; 384expression x;
diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/coccinelle/api/atomic_as_refcounter.cocci
new file mode 100644
index 000000000000..988120e0fd67
--- /dev/null
+++ b/scripts/coccinelle/api/atomic_as_refcounter.cocci
@@ -0,0 +1,129 @@
1// Check if refcount_t type and API should be used
2// instead of atomic_t type when dealing with refcounters
3//
4// Copyright (c) 2016-2017, Elena Reshetova, Intel Corporation
5//
6// Confidence: Moderate
7// URL: http://coccinelle.lip6.fr/
8// Options: --include-headers --very-quiet
9
10virtual report
11
12@r1 exists@
13identifier a, x;
14position p1, p2;
15identifier fname =~ ".*free.*";
16identifier fname2 =~ ".*destroy.*";
17identifier fname3 =~ ".*del.*";
18identifier fname4 =~ ".*queue_work.*";
19identifier fname5 =~ ".*schedule_work.*";
20identifier fname6 =~ ".*call_rcu.*";
21
22@@
23
24(
25 atomic_dec_and_test@p1(&(a)->x)
26|
27 atomic_dec_and_lock@p1(&(a)->x, ...)
28|
29 atomic_long_dec_and_lock@p1(&(a)->x, ...)
30|
31 atomic_long_dec_and_test@p1(&(a)->x)
32|
33 atomic64_dec_and_test@p1(&(a)->x)
34|
35 local_dec_and_test@p1(&(a)->x)
36)
37...
38(
39 fname@p2(a, ...);
40|
41 fname2@p2(...);
42|
43 fname3@p2(...);
44|
45 fname4@p2(...);
46|
47 fname5@p2(...);
48|
49 fname6@p2(...);
50)
51
52
53@script:python depends on report@
54p1 << r1.p1;
55p2 << r1.p2;
56@@
57msg = "atomic_dec_and_test variation before object free at line %s."
58coccilib.report.print_report(p1[0], msg % (p2[0].line))
59
60@r4 exists@
61identifier a, x, y;
62position p1, p2;
63identifier fname =~ ".*free.*";
64
65@@
66
67(
68 atomic_dec_and_test@p1(&(a)->x)
69|
70 atomic_dec_and_lock@p1(&(a)->x, ...)
71|
72 atomic_long_dec_and_lock@p1(&(a)->x, ...)
73|
74 atomic_long_dec_and_test@p1(&(a)->x)
75|
76 atomic64_dec_and_test@p1(&(a)->x)
77|
78 local_dec_and_test@p1(&(a)->x)
79)
80...
81y=a
82...
83fname@p2(y, ...);
84
85
86@script:python depends on report@
87p1 << r4.p1;
88p2 << r4.p2;
89@@
90msg = "atomic_dec_and_test variation before object free at line %s."
91coccilib.report.print_report(p1[0], msg % (p2[0].line))
92
93@r2 exists@
94identifier a, x;
95position p1;
96@@
97
98(
99atomic_add_unless(&(a)->x,-1,1)@p1
100|
101atomic_long_add_unless(&(a)->x,-1,1)@p1
102|
103atomic64_add_unless(&(a)->x,-1,1)@p1
104)
105
106@script:python depends on report@
107p1 << r2.p1;
108@@
109msg = "atomic_add_unless"
110coccilib.report.print_report(p1[0], msg)
111
112@r3 exists@
113identifier x;
114position p1;
115@@
116
117(
118x = atomic_add_return@p1(-1, ...);
119|
120x = atomic_long_add_return@p1(-1, ...);
121|
122x = atomic64_add_return@p1(-1, ...);
123)
124
125@script:python depends on report@
126p1 << r3.p1;
127@@
128msg = "x = atomic_add_return(-1, ...)"
129coccilib.report.print_report(p1[0], msg)
diff --git a/scripts/coccinelle/tests/doubletest.cocci b/scripts/coccinelle/tests/doubletest.cocci
index 78d74c22ca12..7af2ce7eb9bf 100644
--- a/scripts/coccinelle/tests/doubletest.cocci
+++ b/scripts/coccinelle/tests/doubletest.cocci
@@ -1,6 +1,7 @@
1/// Find &&/|| operations that include the same argument more than once 1/// Find &&/|| operations that include the same argument more than once
2//# A common source of false positives is when the argument performs a side 2//# A common source of false positives is when the expression, or
3//# effect. 3//# another expresssion in the same && or || operation, performs a
4//# side effect.
4/// 5///
5// Confidence: Moderate 6// Confidence: Moderate
6// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. 7// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2.
@@ -20,20 +21,37 @@ position p;
20@@ 21@@
21 22
22( 23(
23* E@p 24 E@p || ... || E
24 || ... || E
25| 25|
26* E@p 26 E@p && ... && E
27 && ... && E
28) 27)
29 28
30@script:python depends on org@ 29@bad@
30expression r.E,e1,e2,fn;
31position r.p;
32assignment operator op;
33@@
34
35(
36E@p
37&
38 <+... \(fn(...)\|e1 op e2\|e1++\|e1--\|++e1\|--e1\) ...+>
39)
40
41@depends on context && !bad@
42expression r.E;
43position r.p;
44@@
45
46*E@p
47
48@script:python depends on org && !bad@
31p << r.p; 49p << r.p;
32@@ 50@@
33 51
34cocci.print_main("duplicated argument to && or ||",p) 52cocci.print_main("duplicated argument to && or ||",p)
35 53
36@script:python depends on report@ 54@script:python depends on report && !bad@
37p << r.p; 55p << r.p;
38@@ 56@@
39 57
diff --git a/scripts/depmod.sh b/scripts/depmod.sh
index 1a6f85e0e6e1..999d585eaa73 100755
--- a/scripts/depmod.sh
+++ b/scripts/depmod.sh
@@ -10,10 +10,16 @@ fi
10DEPMOD=$1 10DEPMOD=$1
11KERNELRELEASE=$2 11KERNELRELEASE=$2
12 12
13if ! test -r System.map -a -x "$DEPMOD"; then 13if ! test -r System.map ; then
14 exit 0 14 exit 0
15fi 15fi
16 16
17if [ -z $(command -v $DEPMOD) ]; then
18 echo "'make modules_install' requires $DEPMOD. Please install it." >&2
19 echo "This is probably in the kmod package." >&2
20 exit 1
21fi
22
17# older versions of depmod require the version string to start with three 23# older versions of depmod require the version string to start with three
18# numbers, so we cheat with a symlink here 24# numbers, so we cheat with a symlink here
19depmod_hack_needed=true 25depmod_hack_needed=true
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check
index 078999a3fdff..ad9db6821824 100755
--- a/scripts/documentation-file-ref-check
+++ b/scripts/documentation-file-ref-check
@@ -75,6 +75,12 @@ while (<IN>) {
75 # Remove URL false-positives 75 # Remove URL false-positives
76 next if ($fulref =~ m/^http/); 76 next if ($fulref =~ m/^http/);
77 77
78 # Remove sched-pelt false-positive
79 next if ($fulref =~ m,^Documentation/scheduler/sched-pelt$,);
80
81 # Discard some build examples from Documentation/target/tcm_mod_builder.txt
82 next if ($fulref =~ m,mnt/sdb/lio-core-2.6.git/Documentation/target,);
83
78 # Check if exists, evaluating wildcards 84 # Check if exists, evaluating wildcards
79 next if (grep -e, glob("$ref $fulref")); 85 next if (grep -e, glob("$ref $fulref"));
80 86
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 9cac65b7419c..1c943e03eaf2 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -9,21 +9,11 @@ dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
9dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o 9dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o
10 10
11# Source files need to get at the userspace version of libfdt_env.h to compile 11# Source files need to get at the userspace version of libfdt_env.h to compile
12HOST_EXTRACFLAGS := -I$(src)/libfdt
12 13
13HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt 14# Generated files need one more search path to include headers in source tree
14 15HOSTCFLAGS_dtc-lexer.lex.o := -I$(src)
15HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC) 16HOSTCFLAGS_dtc-parser.tab.o := -I$(src)
16HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
17HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
18HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
19HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
20HOSTCFLAGS_livetree.o := $(HOSTCFLAGS_DTC)
21HOSTCFLAGS_srcpos.o := $(HOSTCFLAGS_DTC)
22HOSTCFLAGS_treesource.o := $(HOSTCFLAGS_DTC)
23HOSTCFLAGS_util.o := $(HOSTCFLAGS_DTC)
24
25HOSTCFLAGS_dtc-lexer.lex.o := $(HOSTCFLAGS_DTC)
26HOSTCFLAGS_dtc-parser.tab.o := $(HOSTCFLAGS_DTC)
27 17
28# dependencies on generated files need to be listed explicitly 18# dependencies on generated files need to be listed explicitly
29$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h 19$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
diff --git a/scripts/extract-vmlinux b/scripts/extract-vmlinux
index 5061abcc2540..e6239f39abad 100755
--- a/scripts/extract-vmlinux
+++ b/scripts/extract-vmlinux
@@ -57,6 +57,8 @@ try_decompress '\3757zXZ\000' abcde unxz
57try_decompress 'BZh' xy bunzip2 57try_decompress 'BZh' xy bunzip2
58try_decompress '\135\0\0\0' xxx unlzma 58try_decompress '\135\0\0\0' xxx unlzma
59try_decompress '\211\114\132' xy 'lzop -d' 59try_decompress '\211\114\132' xy 'lzop -d'
60try_decompress '\002!L\030' xxx 'lz4 -d'
61try_decompress '(\265/\375' xxx unzstd
60 62
61# Bail out: 63# Bail out:
62echo "$me: Cannot find vmlinux." >&2 64echo "$me: Cannot find vmlinux." >&2
diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig
new file mode 100644
index 000000000000..cb0c889e13aa
--- /dev/null
+++ b/scripts/gcc-plugins/Kconfig
@@ -0,0 +1,142 @@
1preferred-plugin-hostcc := $(if-success,[ $(gcc-version) -ge 40800 ],$(HOSTCXX),$(HOSTCC))
2
3config PLUGIN_HOSTCC
4 string
5 default "$(shell,$(srctree)/scripts/gcc-plugin.sh "$(preferred-plugin-hostcc)" "$(HOSTCXX)" "$(CC)")" if CC_IS_GCC
6 help
7 Host compiler used to build GCC plugins. This can be $(HOSTCXX),
8 $(HOSTCC), or a null string if GCC plugin is unsupported.
9
10config HAVE_GCC_PLUGINS
11 bool
12 help
13 An arch should select this symbol if it supports building with
14 GCC plugins.
15
16menuconfig GCC_PLUGINS
17 bool "GCC plugins"
18 depends on HAVE_GCC_PLUGINS
19 depends on PLUGIN_HOSTCC != ""
20 help
21 GCC plugins are loadable modules that provide extra features to the
22 compiler. They are useful for runtime instrumentation and static analysis.
23
24 See Documentation/gcc-plugins.txt for details.
25
26if GCC_PLUGINS
27
28config GCC_PLUGIN_CYC_COMPLEXITY
29 bool "Compute the cyclomatic complexity of a function" if EXPERT
30 depends on !COMPILE_TEST # too noisy
31 help
32 The complexity M of a function's control flow graph is defined as:
33 M = E - N + 2P
34 where
35
36 E = the number of edges
37 N = the number of nodes
38 P = the number of connected components (exit nodes).
39
40 Enabling this plugin reports the complexity to stderr during the
41 build. It mainly serves as a simple example of how to create a
42 gcc plugin for the kernel.
43
44config GCC_PLUGIN_SANCOV
45 bool
46 help
47 This plugin inserts a __sanitizer_cov_trace_pc() call at the start of
48 basic blocks. It supports all gcc versions with plugin support (from
49 gcc-4.5 on). It is based on the commit "Add fuzzing coverage support"
50 by Dmitry Vyukov <dvyukov@google.com>.
51
52config GCC_PLUGIN_LATENT_ENTROPY
53 bool "Generate some entropy during boot and runtime"
54 help
55 By saying Y here the kernel will instrument some kernel code to
56 extract some entropy from both original and artificially created
57 program state. This will help especially embedded systems where
58 there is little 'natural' source of entropy normally. The cost
59 is some slowdown of the boot process (about 0.5%) and fork and
60 irq processing.
61
62 Note that entropy extracted this way is not cryptographically
63 secure!
64
65 This plugin was ported from grsecurity/PaX. More information at:
66 * https://grsecurity.net/
67 * https://pax.grsecurity.net/
68
69config GCC_PLUGIN_STRUCTLEAK
70 bool "Force initialization of variables containing userspace addresses"
71 # Currently STRUCTLEAK inserts initialization out of live scope of
72 # variables from KASAN point of view. This leads to KASAN false
73 # positive reports. Prohibit this combination for now.
74 depends on !KASAN_EXTRA
75 help
76 This plugin zero-initializes any structures containing a
77 __user attribute. This can prevent some classes of information
78 exposures.
79
80 This plugin was ported from grsecurity/PaX. More information at:
81 * https://grsecurity.net/
82 * https://pax.grsecurity.net/
83
84config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL
85 bool "Force initialize all struct type variables passed by reference"
86 depends on GCC_PLUGIN_STRUCTLEAK
87 depends on !COMPILE_TEST
88 help
89 Zero initialize any struct type local variable that may be passed by
90 reference without having been initialized.
91
92config GCC_PLUGIN_STRUCTLEAK_VERBOSE
93 bool "Report forcefully initialized variables"
94 depends on GCC_PLUGIN_STRUCTLEAK
95 depends on !COMPILE_TEST # too noisy
96 help
97 This option will cause a warning to be printed each time the
98 structleak plugin finds a variable it thinks needs to be
99 initialized. Since not all existing initializers are detected
100 by the plugin, this can produce false positive warnings.
101
102config GCC_PLUGIN_RANDSTRUCT
103 bool "Randomize layout of sensitive kernel structures"
104 select MODVERSIONS if MODULES
105 help
106 If you say Y here, the layouts of structures that are entirely
107 function pointers (and have not been manually annotated with
108 __no_randomize_layout), or structures that have been explicitly
109 marked with __randomize_layout, will be randomized at compile-time.
110 This can introduce the requirement of an additional information
111 exposure vulnerability for exploits targeting these structure
112 types.
113
114 Enabling this feature will introduce some performance impact,
115 slightly increase memory usage, and prevent the use of forensic
116 tools like Volatility against the system (unless the kernel
117 source tree isn't cleaned after kernel installation).
118
119 The seed used for compilation is located at
120 scripts/gcc-plgins/randomize_layout_seed.h. It remains after
121 a make clean to allow for external modules to be compiled with
122 the existing seed and will be removed by a make mrproper or
123 make distclean.
124
125 Note that the implementation requires gcc 4.7 or newer.
126
127 This plugin was ported from grsecurity/PaX. More information at:
128 * https://grsecurity.net/
129 * https://pax.grsecurity.net/
130
131config GCC_PLUGIN_RANDSTRUCT_PERFORMANCE
132 bool "Use cacheline-aware structure randomization"
133 depends on GCC_PLUGIN_RANDSTRUCT
134 depends on !COMPILE_TEST # do not reduce test coverage
135 help
136 If you say Y here, the RANDSTRUCT randomization will make a
137 best effort at restricting randomization to cacheline-sized
138 groups of elements. It will further not randomize bitfields
139 in structures. This reduces the performance hit of RANDSTRUCT
140 at the cost of weakened randomization.
141
142endif
diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
index 326254653bd0..aa0d0ec6936d 100644
--- a/scripts/gcc-plugins/Makefile
+++ b/scripts/gcc-plugins/Makefile
@@ -14,8 +14,6 @@ else
14 export HOST_EXTRACXXFLAGS 14 export HOST_EXTRACXXFLAGS
15endif 15endif
16 16
17export HOSTLIBS
18
19$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h 17$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h
20quiet_cmd_create_randomize_layout_seed = GENSEED $@ 18quiet_cmd_create_randomize_layout_seed = GENSEED $@
21cmd_create_randomize_layout_seed = \ 19cmd_create_randomize_layout_seed = \
@@ -29,7 +27,4 @@ always := $($(HOSTLIBS)-y)
29 27
30$(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o)) 28$(foreach p,$($(HOSTLIBS)-y:%.so=%),$(eval $(p)-objs := $(p).o))
31 29
32subdir-y := $(GCC_PLUGIN_SUBDIR)
33subdir- += $(GCC_PLUGIN_SUBDIR)
34
35clean-files += *.so 30clean-files += *.so
diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
index f46750053377..552d5efd7cb7 100644
--- a/scripts/gcc-plugins/gcc-common.h
+++ b/scripts/gcc-plugins/gcc-common.h
@@ -392,13 +392,6 @@ static inline struct cgraph_node *cgraph_alias_target(struct cgraph_node *n)
392} 392}
393#endif 393#endif
394 394
395#if BUILDING_GCC_VERSION >= 4007 && BUILDING_GCC_VERSION <= 4009
396#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
397 cgraph_create_edge((caller), (callee), (call_stmt), (count), (freq))
398#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \
399 cgraph_create_edge_including_clones((caller), (callee), (old_call_stmt), (call_stmt), (count), (freq), (reason))
400#endif
401
402#if BUILDING_GCC_VERSION <= 4008 395#if BUILDING_GCC_VERSION <= 4008
403#define ENTRY_BLOCK_PTR_FOR_FN(FN) ENTRY_BLOCK_PTR_FOR_FUNCTION(FN) 396#define ENTRY_BLOCK_PTR_FOR_FN(FN) ENTRY_BLOCK_PTR_FOR_FUNCTION(FN)
404#define EXIT_BLOCK_PTR_FOR_FN(FN) EXIT_BLOCK_PTR_FOR_FUNCTION(FN) 397#define EXIT_BLOCK_PTR_FOR_FN(FN) EXIT_BLOCK_PTR_FOR_FUNCTION(FN)
@@ -723,10 +716,23 @@ static inline const char *get_decl_section_name(const_tree decl)
723#define varpool_get_node(decl) varpool_node::get(decl) 716#define varpool_get_node(decl) varpool_node::get(decl)
724#define dump_varpool_node(file, node) (node)->dump(file) 717#define dump_varpool_node(file, node) (node)->dump(file)
725 718
726#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ 719#if BUILDING_GCC_VERSION >= 8000
720#define cgraph_create_edge(caller, callee, call_stmt, count, freq) \
721 (caller)->create_edge((callee), (call_stmt), (count))
722
723#define cgraph_create_edge_including_clones(caller, callee, \
724 old_call_stmt, call_stmt, count, freq, reason) \
725 (caller)->create_edge_including_clones((callee), \
726 (old_call_stmt), (call_stmt), (count), (reason))
727#else
728#define cgraph_create_edge(caller, callee, call_stmt, count, freq) \
727 (caller)->create_edge((callee), (call_stmt), (count), (freq)) 729 (caller)->create_edge((callee), (call_stmt), (count), (freq))
728#define cgraph_create_edge_including_clones(caller, callee, old_call_stmt, call_stmt, count, freq, nest, reason) \ 730
729 (caller)->create_edge_including_clones((callee), (old_call_stmt), (call_stmt), (count), (freq), (reason)) 731#define cgraph_create_edge_including_clones(caller, callee, \
732 old_call_stmt, call_stmt, count, freq, reason) \
733 (caller)->create_edge_including_clones((callee), \
734 (old_call_stmt), (call_stmt), (count), (freq), (reason))
735#endif
730 736
731typedef struct cgraph_node *cgraph_node_ptr; 737typedef struct cgraph_node *cgraph_node_ptr;
732typedef struct cgraph_edge *cgraph_edge_p; 738typedef struct cgraph_edge *cgraph_edge_p;
diff --git a/scripts/gcc-x86_64-has-stack-protector.sh b/scripts/gcc-x86_64-has-stack-protector.sh
index 3755af0cd9f7..75e4e22b986a 100755
--- a/scripts/gcc-x86_64-has-stack-protector.sh
+++ b/scripts/gcc-x86_64-has-stack-protector.sh
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3 3
4echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fno-PIE -fstack-protector - -o - 2> /dev/null | grep -q "%gs" 4echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -m64 -O0 -mcmodel=kernel -fno-PIE -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
deleted file mode 100755
index 10e528b3a08f..000000000000
--- a/scripts/gen_initramfs_list.sh
+++ /dev/null
@@ -1,328 +0,0 @@
1#!/bin/sh
2# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
3# Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org>
4#
5# Released under the terms of the GNU GPL
6#
7# Generate a cpio packed initramfs. It uses gen_init_cpio to generate
8# the cpio archive, and then compresses it.
9# The script may also be used to generate the inputfile used for gen_init_cpio
10# This script assumes that gen_init_cpio is located in usr/ directory
11
12# error out on errors
13set -e
14
15usage() {
16cat << EOF
17Usage:
18$0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
19 -o <file> Create compressed initramfs file named <file> using
20 gen_init_cpio and compressor depending on the extension
21 -u <uid> User ID to map to user ID 0 (root).
22 <uid> is only meaningful if <cpio_source> is a
23 directory. "squash" forces all files to uid 0.
24 -g <gid> Group ID to map to group ID 0 (root).
25 <gid> is only meaningful if <cpio_source> is a
26 directory. "squash" forces all files to gid 0.
27 <cpio_source> File list or directory for cpio archive.
28 If <cpio_source> is a .cpio file it will be used
29 as direct input to initramfs.
30 -d Output the default cpio list.
31
32All options except -o and -l may be repeated and are interpreted
33sequentially and immediately. -u and -g states are preserved across
34<cpio_source> options so an explicit "-u 0 -g 0" is required
35to reset the root/group mapping.
36EOF
37}
38
39# awk style field access
40# $1 - field number; rest is argument string
41field() {
42 shift $1 ; echo $1
43}
44
45list_default_initramfs() {
46 # echo usr/kinit/kinit
47 :
48}
49
50default_initramfs() {
51 cat <<-EOF >> ${output}
52 # This is a very simple, default initramfs
53
54 dir /dev 0755 0 0
55 nod /dev/console 0600 0 0 c 5 1
56 dir /root 0700 0 0
57 # file /kinit usr/kinit/kinit 0755 0 0
58 # slink /init kinit 0755 0 0
59 EOF
60}
61
62filetype() {
63 local argv1="$1"
64
65 # symlink test must come before file test
66 if [ -L "${argv1}" ]; then
67 echo "slink"
68 elif [ -f "${argv1}" ]; then
69 echo "file"
70 elif [ -d "${argv1}" ]; then
71 echo "dir"
72 elif [ -b "${argv1}" -o -c "${argv1}" ]; then
73 echo "nod"
74 elif [ -p "${argv1}" ]; then
75 echo "pipe"
76 elif [ -S "${argv1}" ]; then
77 echo "sock"
78 else
79 echo "invalid"
80 fi
81 return 0
82}
83
84list_print_mtime() {
85 :
86}
87
88print_mtime() {
89 local my_mtime="0"
90
91 if [ -e "$1" ]; then
92 my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1)
93 fi
94
95 echo "# Last modified: ${my_mtime}" >> ${output}
96 echo "" >> ${output}
97}
98
99list_parse() {
100 if [ -L "$1" ]; then
101 return
102 fi
103 echo "$1" | sed 's/:/\\:/g; s/$/ \\/'
104}
105
106# for each file print a line in following format
107# <filetype> <name> <path to file> <octal mode> <uid> <gid>
108# for links, devices etc the format differs. See gen_init_cpio for details
109parse() {
110 local location="$1"
111 local name="/${location#${srcdir}}"
112 # change '//' into '/'
113 name=$(echo "$name" | sed -e 's://*:/:g')
114 local mode="$2"
115 local uid="$3"
116 local gid="$4"
117 local ftype=$(filetype "${location}")
118 # remap uid/gid to 0 if necessary
119 [ "$root_uid" = "squash" ] && uid=0 || [ "$uid" -eq "$root_uid" ] && uid=0
120 [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0
121 local str="${mode} ${uid} ${gid}"
122
123 [ "${ftype}" = "invalid" ] && return 0
124 [ "${location}" = "${srcdir}" ] && return 0
125
126 case "${ftype}" in
127 "file")
128 str="${ftype} ${name} ${location} ${str}"
129 ;;
130 "nod")
131 local dev=`LC_ALL=C ls -l "${location}"`
132 local maj=`field 5 ${dev}`
133 local min=`field 6 ${dev}`
134 maj=${maj%,}
135
136 [ -b "${location}" ] && dev="b" || dev="c"
137
138 str="${ftype} ${name} ${str} ${dev} ${maj} ${min}"
139 ;;
140 "slink")
141 local target=`readlink "${location}"`
142 str="${ftype} ${name} ${target} ${str}"
143 ;;
144 *)
145 str="${ftype} ${name} ${str}"
146 ;;
147 esac
148
149 echo "${str}" >> ${output}
150
151 return 0
152}
153
154unknown_option() {
155 printf "ERROR: unknown option \"$arg\"\n" >&2
156 printf "If the filename validly begins with '-', " >&2
157 printf "then it must be prefixed\n" >&2
158 printf "by './' so that it won't be interpreted as an option." >&2
159 printf "\n" >&2
160 usage >&2
161 exit 1
162}
163
164list_header() {
165 :
166}
167
168header() {
169 printf "\n#####################\n# $1\n" >> ${output}
170}
171
172# process one directory (incl sub-directories)
173dir_filelist() {
174 ${dep_list}header "$1"
175
176 srcdir=$(echo "$1" | sed -e 's://*:/:g')
177 dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | sort)
178
179 # If $dirlist is only one line, then the directory is empty
180 if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
181 ${dep_list}print_mtime "$1"
182
183 echo "${dirlist}" | \
184 while read x; do
185 ${dep_list}parse ${x}
186 done
187 fi
188}
189
190# if only one file is specified and it is .cpio file then use it direct as fs
191# if a directory is specified then add all files in given direcotry to fs
192# if a regular file is specified assume it is in gen_initramfs format
193input_file() {
194 source="$1"
195 if [ -f "$1" ]; then
196 ${dep_list}header "$1"
197 is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\{0,1\}/cpio/')"
198 if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then
199 cpio_file=$1
200 echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed"
201 [ ! -z ${dep_list} ] && echo "$1"
202 return 0
203 fi
204 if [ -z ${dep_list} ]; then
205 print_mtime "$1" >> ${output}
206 cat "$1" >> ${output}
207 else
208 echo "$1 \\"
209 cat "$1" | while read type dir file perm ; do
210 if [ "$type" = "file" ]; then
211 echo "$file \\";
212 fi
213 done
214 fi
215 elif [ -d "$1" ]; then
216 dir_filelist "$1"
217 else
218 echo " ${prog}: Cannot open '$1'" >&2
219 exit 1
220 fi
221}
222
223prog=$0
224root_uid=0
225root_gid=0
226dep_list=
227cpio_file=
228cpio_list=
229output="/dev/stdout"
230output_file=""
231is_cpio_compressed=
232compr="gzip -n -9 -f"
233
234arg="$1"
235case "$arg" in
236 "-l") # files included in initramfs - used by kbuild
237 dep_list="list_"
238 echo "deps_initramfs := $0 \\"
239 shift
240 ;;
241 "-o") # generate compressed cpio image named $1
242 shift
243 output_file="$1"
244 cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)"
245 output=${cpio_list}
246 echo "$output_file" | grep -q "\.gz$" \
247 && [ -x "`which gzip 2> /dev/null`" ] \
248 && compr="gzip -n -9 -f"
249 echo "$output_file" | grep -q "\.bz2$" \
250 && [ -x "`which bzip2 2> /dev/null`" ] \
251 && compr="bzip2 -9 -f"
252 echo "$output_file" | grep -q "\.lzma$" \
253 && [ -x "`which lzma 2> /dev/null`" ] \
254 && compr="lzma -9 -f"
255 echo "$output_file" | grep -q "\.xz$" \
256 && [ -x "`which xz 2> /dev/null`" ] \
257 && compr="xz --check=crc32 --lzma2=dict=1MiB"
258 echo "$output_file" | grep -q "\.lzo$" \
259 && [ -x "`which lzop 2> /dev/null`" ] \
260 && compr="lzop -9 -f"
261 echo "$output_file" | grep -q "\.lz4$" \
262 && [ -x "`which lz4 2> /dev/null`" ] \
263 && compr="lz4 -l -9 -f"
264 echo "$output_file" | grep -q "\.cpio$" && compr="cat"
265 shift
266 ;;
267esac
268while [ $# -gt 0 ]; do
269 arg="$1"
270 shift
271 case "$arg" in
272 "-u") # map $1 to uid=0 (root)
273 root_uid="$1"
274 [ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0)
275 shift
276 ;;
277 "-g") # map $1 to gid=0 (root)
278 root_gid="$1"
279 [ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
280 shift
281 ;;
282 "-d") # display default initramfs list
283 default_list="$arg"
284 ${dep_list}default_initramfs
285 ;;
286 "-h")
287 usage
288 exit 0
289 ;;
290 *)
291 case "$arg" in
292 "-"*)
293 unknown_option
294 ;;
295 *) # input file/dir - process it
296 input_file "$arg" "$#"
297 ;;
298 esac
299 ;;
300 esac
301done
302
303# If output_file is set we will generate cpio archive and compress it
304# we are careful to delete tmp files
305if [ ! -z ${output_file} ]; then
306 if [ -z ${cpio_file} ]; then
307 timestamp=
308 if test -n "$KBUILD_BUILD_TIMESTAMP"; then
309 timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)"
310 if test -n "$timestamp"; then
311 timestamp="-t $timestamp"
312 fi
313 fi
314 cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)"
315 usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile}
316 else
317 cpio_tfile=${cpio_file}
318 fi
319 rm ${cpio_list}
320 if [ "${is_cpio_compressed}" = "compressed" ]; then
321 cat ${cpio_tfile} > ${output_file}
322 else
323 (cat ${cpio_tfile} | ${compr} - > ${output_file}) \
324 || (rm -f ${output_file} ; false)
325 fi
326 [ -z ${cpio_file} ] && rm ${cpio_tfile}
327fi
328exit 0
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index c87fa734e3e1..c1c088ef1420 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -48,6 +48,7 @@ my $output_roles = 0;
48my $output_rolestats = 1; 48my $output_rolestats = 1;
49my $output_section_maxlen = 50; 49my $output_section_maxlen = 50;
50my $scm = 0; 50my $scm = 0;
51my $tree = 1;
51my $web = 0; 52my $web = 0;
52my $subsystem = 0; 53my $subsystem = 0;
53my $status = 0; 54my $status = 0;
@@ -61,7 +62,7 @@ my $self_test = undef;
61my $version = 0; 62my $version = 0;
62my $help = 0; 63my $help = 0;
63my $find_maintainer_files = 0; 64my $find_maintainer_files = 0;
64 65my $maintainer_path;
65my $vcs_used = 0; 66my $vcs_used = 0;
66 67
67my $exit = 0; 68my $exit = 0;
@@ -255,6 +256,7 @@ if (!GetOptions(
255 'subsystem!' => \$subsystem, 256 'subsystem!' => \$subsystem,
256 'status!' => \$status, 257 'status!' => \$status,
257 'scm!' => \$scm, 258 'scm!' => \$scm,
259 'tree!' => \$tree,
258 'web!' => \$web, 260 'web!' => \$web,
259 'letters=s' => \$letters, 261 'letters=s' => \$letters,
260 'pattern-depth=i' => \$pattern_depth, 262 'pattern-depth=i' => \$pattern_depth,
@@ -263,6 +265,7 @@ if (!GetOptions(
263 'fe|file-emails!' => \$file_emails, 265 'fe|file-emails!' => \$file_emails,
264 'f|file' => \$from_filename, 266 'f|file' => \$from_filename,
265 'find-maintainer-files' => \$find_maintainer_files, 267 'find-maintainer-files' => \$find_maintainer_files,
268 'mpath|maintainer-path=s' => \$maintainer_path,
266 'self-test:s' => \$self_test, 269 'self-test:s' => \$self_test,
267 'v|version' => \$version, 270 'v|version' => \$version,
268 'h|help|usage' => \$help, 271 'h|help|usage' => \$help,
@@ -319,7 +322,7 @@ if ($email &&
319 die "$P: Please select at least 1 email option\n"; 322 die "$P: Please select at least 1 email option\n";
320} 323}
321 324
322if (!top_of_kernel_tree($lk_path)) { 325if ($tree && !top_of_kernel_tree($lk_path)) {
323 die "$P: The current directory does not appear to be " 326 die "$P: The current directory does not appear to be "
324 . "a linux kernel source tree.\n"; 327 . "a linux kernel source tree.\n";
325} 328}
@@ -384,26 +387,36 @@ sub find_ignore_git {
384read_all_maintainer_files(); 387read_all_maintainer_files();
385 388
386sub read_all_maintainer_files { 389sub read_all_maintainer_files {
387 if (-d "${lk_path}MAINTAINERS") { 390 my $path = "${lk_path}MAINTAINERS";
388 opendir(DIR, "${lk_path}MAINTAINERS") or die $!; 391 if (defined $maintainer_path) {
389 my @files = readdir(DIR); 392 $path = $maintainer_path;
390 closedir(DIR); 393 # Perl Cookbook tilde expansion if necessary
391 foreach my $file (@files) { 394 $path =~ s@^~([^/]*)@ $1 ? (getpwnam($1))[7] : ( $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($<))[7])@ex;
392 push(@mfiles, "${lk_path}MAINTAINERS/$file") if ($file !~ /^\./); 395 }
393 } 396
394 } 397 if (-d $path) {
395 398 $path .= '/' if ($path !~ m@/$@);
396 if ($find_maintainer_files) { 399 if ($find_maintainer_files) {
397 find( { wanted => \&find_is_maintainer_file, 400 find( { wanted => \&find_is_maintainer_file,
398 preprocess => \&find_ignore_git, 401 preprocess => \&find_ignore_git,
399 no_chdir => 1, 402 no_chdir => 1,
400 }, "${lk_path}"); 403 }, "$path");
404 } else {
405 opendir(DIR, "$path") or die $!;
406 my @files = readdir(DIR);
407 closedir(DIR);
408 foreach my $file (@files) {
409 push(@mfiles, "$path$file") if ($file !~ /^\./);
410 }
411 }
412 } elsif (-f "$path") {
413 push(@mfiles, "$path");
401 } else { 414 } else {
402 push(@mfiles, "${lk_path}MAINTAINERS") if -f "${lk_path}MAINTAINERS"; 415 die "$P: MAINTAINER file not found '$path'\n";
403 } 416 }
404 417 die "$P: No MAINTAINER files found in '$path'\n" if (scalar(@mfiles) == 0);
405 foreach my $file (@mfiles) { 418 foreach my $file (@mfiles) {
406 read_maintainer_file("$file"); 419 read_maintainer_file("$file");
407 } 420 }
408} 421}
409 422
@@ -1031,13 +1044,14 @@ Other options:
1031 --sections => print all of the subsystem sections with pattern matches 1044 --sections => print all of the subsystem sections with pattern matches
1032 --letters => print all matching 'letter' types from all matching sections 1045 --letters => print all matching 'letter' types from all matching sections
1033 --mailmap => use .mailmap file (default: $email_use_mailmap) 1046 --mailmap => use .mailmap file (default: $email_use_mailmap)
1047 --no-tree => run without a kernel tree
1034 --self-test => show potential issues with MAINTAINERS file content 1048 --self-test => show potential issues with MAINTAINERS file content
1035 --version => show version 1049 --version => show version
1036 --help => show this help information 1050 --help => show this help information
1037 1051
1038Default options: 1052Default options:
1039 [--email --nogit --git-fallback --m --r --n --l --multiline --pattern-depth=0 1053 [--email --tree --nogit --git-fallback --m --r --n --l --multiline
1040 --remove-duplicates --rolestats] 1054 --pattern-depth=0 --remove-duplicates --rolestats]
1041 1055
1042Notes: 1056Notes:
1043 Using "-f directory" may give unexpected results: 1057 Using "-f directory" may give unexpected results:
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index a3ac2c91331c..4a7bd2192073 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -3,8 +3,8 @@
3# Kernel configuration targets 3# Kernel configuration targets
4# These targets are used from top-level makefile 4# These targets are used from top-level makefile
5 5
6PHONY += xconfig gconfig menuconfig config syncconfig \ 6PHONY += xconfig gconfig menuconfig config localmodconfig localyesconfig \
7 localmodconfig localyesconfig 7 build_menuconfig build_nconfig build_gconfig build_xconfig
8 8
9ifdef KBUILD_KCONFIG 9ifdef KBUILD_KCONFIG
10Kconfig := $(KBUILD_KCONFIG) 10Kconfig := $(KBUILD_KCONFIG)
@@ -34,14 +34,15 @@ config: $(obj)/conf
34nconfig: $(obj)/nconf 34nconfig: $(obj)/nconf
35 $< $(silent) $(Kconfig) 35 $< $(silent) $(Kconfig)
36 36
37# This has become an internal implementation detail and is now deprecated 37build_menuconfig: $(obj)/mconf
38# for external use. 38
39syncconfig: $(obj)/conf 39build_nconfig: $(obj)/nconf
40 $(Q)mkdir -p include/config include/generated 40
41 $< $(silent) --$@ $(Kconfig) 41build_gconfig: $(obj)/gconf
42
43build_xconfig: $(obj)/qconf
42 44
43localyesconfig localmodconfig: $(obj)/conf 45localyesconfig localmodconfig: $(obj)/conf
44 $(Q)mkdir -p include/config include/generated
45 $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config 46 $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config
46 $(Q)if [ -f .config ]; then \ 47 $(Q)if [ -f .config ]; then \
47 cmp -s .tmp.config .config || \ 48 cmp -s .tmp.config .config || \
@@ -56,8 +57,12 @@ localyesconfig localmodconfig: $(obj)/conf
56 $(Q)rm -f .tmp.config 57 $(Q)rm -f .tmp.config
57 58
58# These targets map 1:1 to the commandline options of 'conf' 59# These targets map 1:1 to the commandline options of 'conf'
60#
61# Note:
62# syncconfig has become an internal implementation detail and is now
63# deprecated for external use
59simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ 64simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
60 alldefconfig randconfig listnewconfig olddefconfig 65 alldefconfig randconfig listnewconfig olddefconfig syncconfig
61PHONY += $(simple-targets) 66PHONY += $(simple-targets)
62 67
63$(simple-targets): $(obj)/conf 68$(simple-targets): $(obj)/conf
@@ -169,29 +174,30 @@ HOSTCFLAGS_zconf.tab.o := -I$(src)
169hostprogs-y += nconf 174hostprogs-y += nconf
170nconf-objs := nconf.o zconf.tab.o nconf.gui.o 175nconf-objs := nconf.o zconf.tab.o nconf.gui.o
171 176
172HOSTLOADLIBES_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs) 177HOSTLDLIBS_nconf = $(shell . $(obj)/.nconf-cfg && echo $$libs)
173HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 178HOSTCFLAGS_nconf.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
174HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags) 179HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/.nconf-cfg && echo $$cflags)
175 180
176$(obj)/nconf.o: $(obj)/.nconf-cfg 181$(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/.nconf-cfg
177 182
178# mconf: Used for the menuconfig target based on lxdialog 183# mconf: Used for the menuconfig target based on lxdialog
179hostprogs-y += mconf 184hostprogs-y += mconf
180lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o 185lxdialog := checklist.o inputbox.o menubox.o textbox.o util.o yesno.o
181mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog)) 186mconf-objs := mconf.o zconf.tab.o $(addprefix lxdialog/, $(lxdialog))
182 187
183HOSTLOADLIBES_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs) 188HOSTLDLIBS_mconf = $(shell . $(obj)/.mconf-cfg && echo $$libs)
184$(foreach f, mconf.o $(lxdialog), \ 189$(foreach f, mconf.o $(lxdialog), \
185 $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags))) 190 $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/.mconf-cfg && echo $$$$cflags)))
186 191
187$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/.mconf-cfg 192$(obj)/mconf.o: $(obj)/.mconf-cfg
193$(addprefix $(obj)/lxdialog/, $(lxdialog)): $(obj)/.mconf-cfg
188 194
189# qconf: Used for the xconfig target based on Qt 195# qconf: Used for the xconfig target based on Qt
190hostprogs-y += qconf 196hostprogs-y += qconf
191qconf-cxxobjs := qconf.o 197qconf-cxxobjs := qconf.o
192qconf-objs := zconf.tab.o 198qconf-objs := zconf.tab.o
193 199
194HOSTLOADLIBES_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs) 200HOSTLDLIBS_qconf = $(shell . $(obj)/.qconf-cfg && echo $$libs)
195HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags) 201HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/.qconf-cfg && echo $$cflags)
196 202
197$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc 203$(obj)/qconf.o: $(obj)/.qconf-cfg $(obj)/qconf.moc
@@ -206,7 +212,7 @@ $(obj)/%.moc: $(src)/%.h $(obj)/.qconf-cfg
206hostprogs-y += gconf 212hostprogs-y += gconf
207gconf-objs := gconf.o zconf.tab.o 213gconf-objs := gconf.o zconf.tab.o
208 214
209HOSTLOADLIBES_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs) 215HOSTLDLIBS_gconf = $(shell . $(obj)/.gconf-cfg && echo $$libs)
210HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags) 216HOSTCFLAGS_gconf.o = $(shell . $(obj)/.gconf-cfg && echo $$cflags)
211 217
212$(obj)/gconf.o: $(obj)/.gconf-cfg 218$(obj)/gconf.o: $(obj)/.gconf-cfg
@@ -215,6 +221,7 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c
215 221
216# check if necessary packages are available, and configure build flags 222# check if necessary packages are available, and configure build flags
217define filechk_conf_cfg 223define filechk_conf_cfg
224 $(CONFIG_SHELL) $(srctree)/scripts/kconfig/check-pkgconfig.sh; \
218 $(CONFIG_SHELL) $< 225 $(CONFIG_SHELL) $<
219endef 226endef
220 227
diff --git a/scripts/kconfig/check-pkgconfig.sh b/scripts/kconfig/check-pkgconfig.sh
new file mode 100644
index 000000000000..7a1c40bfb58c
--- /dev/null
+++ b/scripts/kconfig/check-pkgconfig.sh
@@ -0,0 +1,8 @@
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# Check for pkg-config presence
4
5if [ -z $(command -v pkg-config) ]; then
6 echo "'make *config' requires 'pkg-config'. Please install it." 1>&2
7 exit 1
8fi
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 671ff5364497..7b2b37260669 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -496,6 +496,7 @@ int main(int ac, char **av)
496 int opt; 496 int opt;
497 const char *name, *defconfig_file = NULL /* gcc uninit */; 497 const char *name, *defconfig_file = NULL /* gcc uninit */;
498 struct stat tmpstat; 498 struct stat tmpstat;
499 int no_conf_write = 0;
499 500
500 tty_stdio = isatty(0) && isatty(1); 501 tty_stdio = isatty(0) && isatty(1);
501 502
@@ -507,6 +508,11 @@ int main(int ac, char **av)
507 input_mode = (enum input_mode)opt; 508 input_mode = (enum input_mode)opt;
508 switch (opt) { 509 switch (opt) {
509 case syncconfig: 510 case syncconfig:
511 /*
512 * syncconfig is invoked during the build stage.
513 * Suppress distracting "configuration written to ..."
514 */
515 conf_set_message_callback(NULL);
510 sync_kconfig = 1; 516 sync_kconfig = 1;
511 break; 517 break;
512 case defconfig: 518 case defconfig:
@@ -633,13 +639,14 @@ int main(int ac, char **av)
633 } 639 }
634 640
635 if (sync_kconfig) { 641 if (sync_kconfig) {
636 if (conf_get_changed()) { 642 name = getenv("KCONFIG_NOSILENTUPDATE");
637 name = getenv("KCONFIG_NOSILENTUPDATE"); 643 if (name && *name) {
638 if (name && *name) { 644 if (conf_get_changed()) {
639 fprintf(stderr, 645 fprintf(stderr,
640 "\n*** The configuration requires explicit update.\n\n"); 646 "\n*** The configuration requires explicit update.\n\n");
641 return 1; 647 return 1;
642 } 648 }
649 no_conf_write = 1;
643 } 650 }
644 } 651 }
645 652
@@ -684,29 +691,32 @@ int main(int ac, char **av)
684 break; 691 break;
685 } 692 }
686 693
687 if (sync_kconfig) { 694 if (input_mode == savedefconfig) {
688 /* syncconfig is used during the build so we shall update autoconf.
689 * All other commands are only used to generate a config.
690 */
691 if (conf_get_changed() && conf_write(NULL)) {
692 fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
693 exit(1);
694 }
695 if (conf_write_autoconf()) {
696 fprintf(stderr, "\n*** Error during update of the configuration.\n\n");
697 return 1;
698 }
699 } else if (input_mode == savedefconfig) {
700 if (conf_write_defconfig(defconfig_file)) { 695 if (conf_write_defconfig(defconfig_file)) {
701 fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n", 696 fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n",
702 defconfig_file); 697 defconfig_file);
703 return 1; 698 return 1;
704 } 699 }
705 } else if (input_mode != listnewconfig) { 700 } else if (input_mode != listnewconfig) {
706 if (conf_write(NULL)) { 701 if (!no_conf_write && conf_write(NULL)) {
707 fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); 702 fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
708 exit(1); 703 exit(1);
709 } 704 }
705
706 /*
707 * Create auto.conf if it does not exist.
708 * This prevents GNU Make 4.1 or older from emitting
709 * "include/config/auto.conf: No such file or directory"
710 * in the top-level Makefile
711 *
712 * syncconfig always creates or updates auto.conf because it is
713 * used during the build.
714 */
715 if (conf_write_autoconf(sync_kconfig) && sync_kconfig) {
716 fprintf(stderr,
717 "\n*** Error during sync of the configuration.\n\n");
718 return 1;
719 }
710 } 720 }
711 return 0; 721 return 0;
712} 722}
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 39e20974f4a3..91d0a5c014ac 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -16,6 +16,64 @@
16 16
17#include "lkc.h" 17#include "lkc.h"
18 18
19/* return true if 'path' exists, false otherwise */
20static bool is_present(const char *path)
21{
22 struct stat st;
23
24 return !stat(path, &st);
25}
26
27/* return true if 'path' exists and it is a directory, false otherwise */
28static bool is_dir(const char *path)
29{
30 struct stat st;
31
32 if (stat(path, &st))
33 return 0;
34
35 return S_ISDIR(st.st_mode);
36}
37
38/*
39 * Create the parent directory of the given path.
40 *
41 * For example, if 'include/config/auto.conf' is given, create 'include/config'.
42 */
43static int make_parent_dir(const char *path)
44{
45 char tmp[PATH_MAX + 1];
46 char *p;
47
48 strncpy(tmp, path, sizeof(tmp));
49 tmp[sizeof(tmp) - 1] = 0;
50
51 /* Remove the base name. Just return if nothing is left */
52 p = strrchr(tmp, '/');
53 if (!p)
54 return 0;
55 *(p + 1) = 0;
56
57 /* Just in case it is an absolute path */
58 p = tmp;
59 while (*p == '/')
60 p++;
61
62 while ((p = strchr(p, '/'))) {
63 *p = 0;
64
65 /* skip if the directory exists */
66 if (!is_dir(tmp) && mkdir(tmp, 0755))
67 return -1;
68
69 *p = '/';
70 while (*p == '/')
71 p++;
72 }
73
74 return 0;
75}
76
19struct conf_printer { 77struct conf_printer {
20 void (*print_symbol)(FILE *, struct symbol *, const char *, void *); 78 void (*print_symbol)(FILE *, struct symbol *, const char *, void *);
21 void (*print_comment)(FILE *, const char *, void *); 79 void (*print_comment)(FILE *, const char *, void *);
@@ -43,16 +101,16 @@ static void conf_warning(const char *fmt, ...)
43 conf_warnings++; 101 conf_warnings++;
44} 102}
45 103
46static void conf_default_message_callback(const char *fmt, va_list ap) 104static void conf_default_message_callback(const char *s)
47{ 105{
48 printf("#\n# "); 106 printf("#\n# ");
49 vprintf(fmt, ap); 107 printf("%s", s);
50 printf("\n#\n"); 108 printf("\n#\n");
51} 109}
52 110
53static void (*conf_message_callback) (const char *fmt, va_list ap) = 111static void (*conf_message_callback)(const char *s) =
54 conf_default_message_callback; 112 conf_default_message_callback;
55void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap)) 113void conf_set_message_callback(void (*fn)(const char *s))
56{ 114{
57 conf_message_callback = fn; 115 conf_message_callback = fn;
58} 116}
@@ -60,10 +118,15 @@ void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap))
60static void conf_message(const char *fmt, ...) 118static void conf_message(const char *fmt, ...)
61{ 119{
62 va_list ap; 120 va_list ap;
121 char buf[4096];
122
123 if (!conf_message_callback)
124 return;
63 125
64 va_start(ap, fmt); 126 va_start(ap, fmt);
65 if (conf_message_callback) 127
66 conf_message_callback(fmt, ap); 128 vsnprintf(buf, sizeof(buf), fmt, ap);
129 conf_message_callback(buf);
67 va_end(ap); 130 va_end(ap);
68} 131}
69 132
@@ -83,7 +146,6 @@ const char *conf_get_autoconfig_name(void)
83 146
84char *conf_get_default_confname(void) 147char *conf_get_default_confname(void)
85{ 148{
86 struct stat buf;
87 static char fullname[PATH_MAX+1]; 149 static char fullname[PATH_MAX+1];
88 char *env, *name; 150 char *env, *name;
89 151
@@ -91,7 +153,7 @@ char *conf_get_default_confname(void)
91 env = getenv(SRCTREE); 153 env = getenv(SRCTREE);
92 if (env) { 154 if (env) {
93 sprintf(fullname, "%s/%s", env, name); 155 sprintf(fullname, "%s/%s", env, name);
94 if (!stat(fullname, &buf)) 156 if (is_present(fullname))
95 return fullname; 157 return fullname;
96 } 158 }
97 return name; 159 return name;
@@ -397,7 +459,7 @@ int conf_read(const char *name)
397 459
398 for_all_symbols(i, sym) { 460 for_all_symbols(i, sym) {
399 sym_calc_value(sym); 461 sym_calc_value(sym);
400 if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) 462 if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE))
401 continue; 463 continue;
402 if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { 464 if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) {
403 /* check that calculated value agrees with saved value */ 465 /* check that calculated value agrees with saved value */
@@ -725,10 +787,9 @@ int conf_write(const char *name)
725 787
726 dirname[0] = 0; 788 dirname[0] = 0;
727 if (name && name[0]) { 789 if (name && name[0]) {
728 struct stat st;
729 char *slash; 790 char *slash;
730 791
731 if (!stat(name, &st) && S_ISDIR(st.st_mode)) { 792 if (is_dir(name)) {
732 strcpy(dirname, name); 793 strcpy(dirname, name);
733 strcat(dirname, "/"); 794 strcat(dirname, "/");
734 basename = conf_get_configname(); 795 basename = conf_get_configname();
@@ -813,26 +874,59 @@ next:
813 return 0; 874 return 0;
814} 875}
815 876
877/* write a dependency file as used by kbuild to track dependencies */
878static int conf_write_dep(const char *name)
879{
880 struct file *file;
881 FILE *out;
882
883 if (!name)
884 name = ".kconfig.d";
885 out = fopen("..config.tmp", "w");
886 if (!out)
887 return 1;
888 fprintf(out, "deps_config := \\\n");
889 for (file = file_list; file; file = file->next) {
890 if (file->next)
891 fprintf(out, "\t%s \\\n", file->name);
892 else
893 fprintf(out, "\t%s\n", file->name);
894 }
895 fprintf(out, "\n%s: \\\n"
896 "\t$(deps_config)\n\n", conf_get_autoconfig_name());
897
898 env_write_dep(out, conf_get_autoconfig_name());
899
900 fprintf(out, "\n$(deps_config): ;\n");
901 fclose(out);
902
903 if (make_parent_dir(name))
904 return 1;
905 rename("..config.tmp", name);
906 return 0;
907}
908
816static int conf_split_config(void) 909static int conf_split_config(void)
817{ 910{
818 const char *name; 911 const char *name;
819 char path[PATH_MAX+1]; 912 char path[PATH_MAX+1];
820 char *s, *d, c; 913 char *s, *d, c;
821 struct symbol *sym; 914 struct symbol *sym;
822 struct stat sb;
823 int res, i, fd; 915 int res, i, fd;
824 916
825 name = conf_get_autoconfig_name(); 917 name = conf_get_autoconfig_name();
826 conf_read_simple(name, S_DEF_AUTO); 918 conf_read_simple(name, S_DEF_AUTO);
827 sym_calc_value(modules_sym); 919 sym_calc_value(modules_sym);
828 920
921 if (make_parent_dir("include/config/foo.h"))
922 return 1;
829 if (chdir("include/config")) 923 if (chdir("include/config"))
830 return 1; 924 return 1;
831 925
832 res = 0; 926 res = 0;
833 for_all_symbols(i, sym) { 927 for_all_symbols(i, sym) {
834 sym_calc_value(sym); 928 sym_calc_value(sym);
835 if ((sym->flags & SYMBOL_AUTO) || !sym->name) 929 if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name)
836 continue; 930 continue;
837 if (sym->flags & SYMBOL_WRITE) { 931 if (sym->flags & SYMBOL_WRITE) {
838 if (sym->flags & SYMBOL_DEF_AUTO) { 932 if (sym->flags & SYMBOL_DEF_AUTO) {
@@ -897,19 +991,12 @@ static int conf_split_config(void)
897 res = 1; 991 res = 1;
898 break; 992 break;
899 } 993 }
900 /* 994
901 * Create directory components, 995 if (make_parent_dir(path)) {
902 * unless they exist already. 996 res = 1;
903 */ 997 goto out;
904 d = path;
905 while ((d = strchr(d, '/'))) {
906 *d = 0;
907 if (stat(path, &sb) && mkdir(path, 0755)) {
908 res = 1;
909 goto out;
910 }
911 *d++ = '/';
912 } 998 }
999
913 /* Try it again. */ 1000 /* Try it again. */
914 fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); 1001 fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
915 if (fd == -1) { 1002 if (fd == -1) {
@@ -926,16 +1013,20 @@ out:
926 return res; 1013 return res;
927} 1014}
928 1015
929int conf_write_autoconf(void) 1016int conf_write_autoconf(int overwrite)
930{ 1017{
931 struct symbol *sym; 1018 struct symbol *sym;
932 const char *name; 1019 const char *name;
1020 const char *autoconf_name = conf_get_autoconfig_name();
933 FILE *out, *tristate, *out_h; 1021 FILE *out, *tristate, *out_h;
934 int i; 1022 int i;
935 1023
1024 if (!overwrite && is_present(autoconf_name))
1025 return 0;
1026
936 sym_clear_all_valid(); 1027 sym_clear_all_valid();
937 1028
938 file_write_dep("include/config/auto.conf.cmd"); 1029 conf_write_dep("include/config/auto.conf.cmd");
939 1030
940 if (conf_split_config()) 1031 if (conf_split_config())
941 return 1; 1032 return 1;
@@ -982,19 +1073,26 @@ int conf_write_autoconf(void)
982 name = getenv("KCONFIG_AUTOHEADER"); 1073 name = getenv("KCONFIG_AUTOHEADER");
983 if (!name) 1074 if (!name)
984 name = "include/generated/autoconf.h"; 1075 name = "include/generated/autoconf.h";
1076 if (make_parent_dir(name))
1077 return 1;
985 if (rename(".tmpconfig.h", name)) 1078 if (rename(".tmpconfig.h", name))
986 return 1; 1079 return 1;
1080
987 name = getenv("KCONFIG_TRISTATE"); 1081 name = getenv("KCONFIG_TRISTATE");
988 if (!name) 1082 if (!name)
989 name = "include/config/tristate.conf"; 1083 name = "include/config/tristate.conf";
1084 if (make_parent_dir(name))
1085 return 1;
990 if (rename(".tmpconfig_tristate", name)) 1086 if (rename(".tmpconfig_tristate", name))
991 return 1; 1087 return 1;
992 name = conf_get_autoconfig_name(); 1088
1089 if (make_parent_dir(autoconf_name))
1090 return 1;
993 /* 1091 /*
994 * This must be the last step, kbuild has a dependency on auto.conf 1092 * This must be the last step, kbuild has a dependency on auto.conf
995 * and this marks the successful completion of the previous steps. 1093 * and this marks the successful completion of the previous steps.
996 */ 1094 */
997 if (rename(".tmpconfig", name)) 1095 if (rename(".tmpconfig", autoconf_name))
998 return 1; 1096 return 1;
999 1097
1000 return 0; 1098 return 0;
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 94a383b21df6..7c329e179007 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -141,7 +141,7 @@ struct symbol {
141#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */ 141#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */
142#define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */ 142#define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */
143#define SYMBOL_CHANGED 0x0400 /* ? */ 143#define SYMBOL_CHANGED 0x0400 /* ? */
144#define SYMBOL_AUTO 0x1000 /* value from environment variable */ 144#define SYMBOL_NO_WRITE 0x1000 /* Symbol for internal use only; it will not be written */
145#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */ 145#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */
146#define SYMBOL_WARNED 0x8000 /* warning has been issued */ 146#define SYMBOL_WARNED 0x8000 /* warning has been issued */
147 147
@@ -171,6 +171,9 @@ struct symbol {
171 * config BAZ 171 * config BAZ
172 * int "BAZ Value" 172 * int "BAZ Value"
173 * range 1..255 173 * range 1..255
174 *
175 * Please, also check zconf.y:print_symbol() when modifying the
176 * list of property types!
174 */ 177 */
175enum prop_type { 178enum prop_type {
176 P_UNKNOWN, 179 P_UNKNOWN,
@@ -182,7 +185,6 @@ enum prop_type {
182 P_SELECT, /* select BAR */ 185 P_SELECT, /* select BAR */
183 P_IMPLY, /* imply BAR */ 186 P_IMPLY, /* imply BAR */
184 P_RANGE, /* range 7..100 (for a symbol) */ 187 P_RANGE, /* range 7..100 (for a symbol) */
185 P_ENV, /* value from environment variable */
186 P_SYMBOL, /* where a symbol is defined */ 188 P_SYMBOL, /* where a symbol is defined */
187}; 189};
188 190
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 610c4ab54d76..36f578415c4a 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -101,8 +101,8 @@ const char *dbg_sym_flags(int val)
101 strcat(buf, "write/"); 101 strcat(buf, "write/");
102 if (val & SYMBOL_CHANGED) 102 if (val & SYMBOL_CHANGED)
103 strcat(buf, "changed/"); 103 strcat(buf, "changed/");
104 if (val & SYMBOL_AUTO) 104 if (val & SYMBOL_NO_WRITE)
105 strcat(buf, "auto/"); 105 strcat(buf, "no_write/");
106 106
107 buf[strlen(buf) - 1] = '\0'; 107 buf[strlen(buf) - 1] = '\0';
108 108
@@ -525,6 +525,7 @@ void on_save_activate(GtkMenuItem * menuitem, gpointer user_data)
525{ 525{
526 if (conf_write(NULL)) 526 if (conf_write(NULL))
527 text_insert_msg("Error", "Unable to save configuration !"); 527 text_insert_msg("Error", "Unable to save configuration !");
528 conf_write_autoconf(0);
528} 529}
529 530
530 531
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index ed3ff88e60ba..9eb7c837cd8f 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -97,7 +97,6 @@ void menu_set_type(int type);
97 97
98/* util.c */ 98/* util.c */
99struct file *file_lookup(const char *name); 99struct file *file_lookup(const char *name);
100int file_write_dep(const char *name);
101void *xmalloc(size_t size); 100void *xmalloc(size_t size);
102void *xcalloc(size_t nmemb, size_t size); 101void *xcalloc(size_t nmemb, size_t size);
103void *xrealloc(void *p, size_t size); 102void *xrealloc(void *p, size_t size);
@@ -126,7 +125,6 @@ const char *sym_get_string_default(struct symbol *sym);
126struct symbol *sym_check_deps(struct symbol *sym); 125struct symbol *sym_check_deps(struct symbol *sym);
127struct property *prop_alloc(enum prop_type type, struct symbol *sym); 126struct property *prop_alloc(enum prop_type type, struct symbol *sym);
128struct symbol *prop_get_symbol(struct property *prop); 127struct symbol *prop_get_symbol(struct property *prop);
129struct property *sym_get_env_prop(struct symbol *sym);
130 128
131static inline tristate sym_get_tristate_value(struct symbol *sym) 129static inline tristate sym_get_tristate_value(struct symbol *sym)
132{ 130{
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index a8b7a330587e..86c267540ccc 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -7,10 +7,10 @@ int conf_read(const char *name);
7int conf_read_simple(const char *name, int); 7int conf_read_simple(const char *name, int);
8int conf_write_defconfig(const char *name); 8int conf_write_defconfig(const char *name);
9int conf_write(const char *name); 9int conf_write(const char *name);
10int conf_write_autoconf(void); 10int conf_write_autoconf(int overwrite);
11bool conf_get_changed(void); 11bool conf_get_changed(void);
12void conf_set_changed_callback(void (*fn)(void)); 12void conf_set_changed_callback(void (*fn)(void));
13void conf_set_message_callback(void (*fn)(const char *fmt, va_list ap)); 13void conf_set_message_callback(void (*fn)(const char *s));
14 14
15/* menu.c */ 15/* menu.c */
16extern struct menu rootmenu; 16extern struct menu rootmenu;
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 5294ed159b98..83b5836615fb 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -772,16 +772,13 @@ static void show_helptext(const char *title, const char *text)
772 show_textbox(title, text, 0, 0); 772 show_textbox(title, text, 0, 0);
773} 773}
774 774
775static void conf_message_callback(const char *fmt, va_list ap) 775static void conf_message_callback(const char *s)
776{ 776{
777 char buf[PATH_MAX+1];
778
779 vsnprintf(buf, sizeof(buf), fmt, ap);
780 if (save_and_exit) { 777 if (save_and_exit) {
781 if (!silent) 778 if (!silent)
782 printf("%s", buf); 779 printf("%s", s);
783 } else { 780 } else {
784 show_textbox(NULL, buf, 6, 60); 781 show_textbox(NULL, s, 6, 60);
785 } 782 }
786} 783}
787 784
@@ -977,6 +974,7 @@ static int handle_exit(void)
977 "\n\n"); 974 "\n\n");
978 return 1; 975 return 1;
979 } 976 }
977 conf_write_autoconf(0);
980 /* fall through */ 978 /* fall through */
981 case -1: 979 case -1:
982 if (!silent) 980 if (!silent)
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 379a119dcd1e..4cf15d449c05 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -212,7 +212,7 @@ void menu_add_option(int token, char *arg)
212 sym_defconfig_list = current_entry->sym; 212 sym_defconfig_list = current_entry->sym;
213 else if (sym_defconfig_list != current_entry->sym) 213 else if (sym_defconfig_list != current_entry->sym)
214 zconf_error("trying to redefine defconfig symbol"); 214 zconf_error("trying to redefine defconfig symbol");
215 sym_defconfig_list->flags |= SYMBOL_AUTO; 215 sym_defconfig_list->flags |= SYMBOL_NO_WRITE;
216 break; 216 break;
217 case T_OPT_ALLNOCONFIG_Y: 217 case T_OPT_ALLNOCONFIG_Y:
218 current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y; 218 current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y;
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 97b78445584b..1ef232ae5ab9 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -674,6 +674,7 @@ static int do_exit(void)
674 "Your configuration changes were NOT saved.", 674 "Your configuration changes were NOT saved.",
675 1, 675 1,
676 "<OK>"); 676 "<OK>");
677 conf_write_autoconf(0);
677 break; 678 break;
678 default: 679 default:
679 btn_dialog( 680 btn_dialog(
@@ -1210,12 +1211,9 @@ static void conf(struct menu *menu)
1210 } 1211 }
1211} 1212}
1212 1213
1213static void conf_message_callback(const char *fmt, va_list ap) 1214static void conf_message_callback(const char *s)
1214{ 1215{
1215 char buf[1024]; 1216 btn_dialog(main_window, s, 1, "<OK>");
1216
1217 vsnprintf(buf, sizeof(buf), fmt, ap);
1218 btn_dialog(main_window, buf, 1, "<OK>");
1219} 1217}
1220 1218
1221static void show_help(struct menu *menu) 1219static void show_help(struct menu *menu)
diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c
index 65da87fce907..5ca2df790d3c 100644
--- a/scripts/kconfig/preprocess.c
+++ b/scripts/kconfig/preprocess.c
@@ -156,7 +156,7 @@ static char *do_shell(int argc, char *argv[])
156 nread--; 156 nread--;
157 157
158 /* remove trailing new lines */ 158 /* remove trailing new lines */
159 while (buf[nread - 1] == '\n') 159 while (nread > 0 && buf[nread - 1] == '\n')
160 nread--; 160 nread--;
161 161
162 buf[nread] = 0; 162 buf[nread] = 0;
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index ad9c22dd04f5..ef4310f2558b 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1149,7 +1149,6 @@ QString ConfigInfoView::debug_info(struct symbol *sym)
1149 case P_DEFAULT: 1149 case P_DEFAULT:
1150 case P_SELECT: 1150 case P_SELECT:
1151 case P_RANGE: 1151 case P_RANGE:
1152 case P_ENV:
1153 debug += prop_get_type_name(prop->type); 1152 debug += prop_get_type_name(prop->type);
1154 debug += ": "; 1153 debug += ": ";
1155 expr_print(prop->expr, expr_print_help, &debug, E_NONE); 1154 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
@@ -1535,6 +1534,8 @@ bool ConfigMainWindow::saveConfig(void)
1535 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 1534 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1536 return false; 1535 return false;
1537 } 1536 }
1537 conf_write_autoconf(0);
1538
1538 return true; 1539 return true;
1539} 1540}
1540 1541
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 7c9a88e91cfa..703b9b899ee9 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -76,15 +76,6 @@ struct property *sym_get_choice_prop(struct symbol *sym)
76 return NULL; 76 return NULL;
77} 77}
78 78
79struct property *sym_get_env_prop(struct symbol *sym)
80{
81 struct property *prop;
82
83 for_all_properties(sym, prop, P_ENV)
84 return prop;
85 return NULL;
86}
87
88static struct property *sym_get_default_prop(struct symbol *sym) 79static struct property *sym_get_default_prop(struct symbol *sym)
89{ 80{
90 struct property *prop; 81 struct property *prop;
@@ -463,7 +454,7 @@ void sym_calc_value(struct symbol *sym)
463 } 454 }
464 } 455 }
465 456
466 if (sym->flags & SYMBOL_AUTO) 457 if (sym->flags & SYMBOL_NO_WRITE)
467 sym->flags &= ~SYMBOL_WRITE; 458 sym->flags &= ~SYMBOL_WRITE;
468 459
469 if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) 460 if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES)
@@ -1020,7 +1011,7 @@ static struct dep_stack {
1020 struct dep_stack *prev, *next; 1011 struct dep_stack *prev, *next;
1021 struct symbol *sym; 1012 struct symbol *sym;
1022 struct property *prop; 1013 struct property *prop;
1023 struct expr *expr; 1014 struct expr **expr;
1024} *check_top; 1015} *check_top;
1025 1016
1026static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym) 1017static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym)
@@ -1085,31 +1076,42 @@ static void sym_check_print_recursive(struct symbol *last_sym)
1085 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", 1076 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
1086 prop->file->name, prop->lineno); 1077 prop->file->name, prop->lineno);
1087 1078
1088 if (stack->expr) { 1079 if (sym_is_choice(sym)) {
1089 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", 1080 fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
1090 prop->file->name, prop->lineno, 1081 menu->file->name, menu->lineno,
1082 sym->name ? sym->name : "<choice>",
1083 next_sym->name ? next_sym->name : "<choice>");
1084 } else if (sym_is_choice_value(sym)) {
1085 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",
1086 menu->file->name, menu->lineno,
1091 sym->name ? sym->name : "<choice>", 1087 sym->name ? sym->name : "<choice>",
1092 prop_get_type_name(prop->type),
1093 next_sym->name ? next_sym->name : "<choice>"); 1088 next_sym->name ? next_sym->name : "<choice>");
1094 } else if (stack->prop) { 1089 } else if (stack->expr == &sym->dir_dep.expr) {
1095 fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n", 1090 fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n",
1096 prop->file->name, prop->lineno, 1091 prop->file->name, prop->lineno,
1097 sym->name ? sym->name : "<choice>", 1092 sym->name ? sym->name : "<choice>",
1098 next_sym->name ? next_sym->name : "<choice>"); 1093 next_sym->name ? next_sym->name : "<choice>");
1099 } else if (sym_is_choice(sym)) { 1094 } else if (stack->expr == &sym->rev_dep.expr) {
1100 fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n", 1095 fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n",
1101 menu->file->name, menu->lineno, 1096 prop->file->name, prop->lineno,
1102 sym->name ? sym->name : "<choice>", 1097 sym->name ? sym->name : "<choice>",
1103 next_sym->name ? next_sym->name : "<choice>"); 1098 next_sym->name ? next_sym->name : "<choice>");
1104 } else if (sym_is_choice_value(sym)) { 1099 } else if (stack->expr == &sym->implied.expr) {
1105 fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", 1100 fprintf(stderr, "%s:%d:\tsymbol %s is implied by %s\n",
1106 menu->file->name, menu->lineno, 1101 prop->file->name, prop->lineno,
1107 sym->name ? sym->name : "<choice>", 1102 sym->name ? sym->name : "<choice>",
1108 next_sym->name ? next_sym->name : "<choice>"); 1103 next_sym->name ? next_sym->name : "<choice>");
1104 } else if (stack->expr) {
1105 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
1106 prop->file->name, prop->lineno,
1107 sym->name ? sym->name : "<choice>",
1108 prop_get_type_name(prop->type),
1109 next_sym->name ? next_sym->name : "<choice>");
1109 } else { 1110 } else {
1110 fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n", 1111 fprintf(stderr, "%s:%d:\tsymbol %s %s is visible depending on %s\n",
1111 prop->file->name, prop->lineno, 1112 prop->file->name, prop->lineno,
1112 sym->name ? sym->name : "<choice>", 1113 sym->name ? sym->name : "<choice>",
1114 prop_get_type_name(prop->type),
1113 next_sym->name ? next_sym->name : "<choice>"); 1115 next_sym->name ? next_sym->name : "<choice>");
1114 } 1116 }
1115 } 1117 }
@@ -1166,12 +1168,26 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
1166 1168
1167 dep_stack_insert(&stack, sym); 1169 dep_stack_insert(&stack, sym);
1168 1170
1171 stack.expr = &sym->dir_dep.expr;
1172 sym2 = sym_check_expr_deps(sym->dir_dep.expr);
1173 if (sym2)
1174 goto out;
1175
1176 stack.expr = &sym->rev_dep.expr;
1169 sym2 = sym_check_expr_deps(sym->rev_dep.expr); 1177 sym2 = sym_check_expr_deps(sym->rev_dep.expr);
1170 if (sym2) 1178 if (sym2)
1171 goto out; 1179 goto out;
1172 1180
1181 stack.expr = &sym->implied.expr;
1182 sym2 = sym_check_expr_deps(sym->implied.expr);
1183 if (sym2)
1184 goto out;
1185
1186 stack.expr = NULL;
1187
1173 for (prop = sym->prop; prop; prop = prop->next) { 1188 for (prop = sym->prop; prop; prop = prop->next) {
1174 if (prop->type == P_CHOICE || prop->type == P_SELECT) 1189 if (prop->type == P_CHOICE || prop->type == P_SELECT ||
1190 prop->type == P_IMPLY)
1175 continue; 1191 continue;
1176 stack.prop = prop; 1192 stack.prop = prop;
1177 sym2 = sym_check_expr_deps(prop->visible.expr); 1193 sym2 = sym_check_expr_deps(prop->visible.expr);
@@ -1179,7 +1195,7 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym)
1179 break; 1195 break;
1180 if (prop->type != P_DEFAULT || sym_is_choice(sym)) 1196 if (prop->type != P_DEFAULT || sym_is_choice(sym))
1181 continue; 1197 continue;
1182 stack.expr = prop->expr; 1198 stack.expr = &prop->expr;
1183 sym2 = sym_check_expr_deps(prop->expr); 1199 sym2 = sym_check_expr_deps(prop->expr);
1184 if (sym2) 1200 if (sym2)
1185 break; 1201 break;
@@ -1257,9 +1273,6 @@ struct symbol *sym_check_deps(struct symbol *sym)
1257 sym->flags &= ~SYMBOL_CHECK; 1273 sym->flags &= ~SYMBOL_CHECK;
1258 } 1274 }
1259 1275
1260 if (sym2 && sym2 == sym)
1261 sym2 = NULL;
1262
1263 return sym2; 1276 return sym2;
1264} 1277}
1265 1278
@@ -1298,8 +1311,6 @@ const char *prop_get_type_name(enum prop_type type)
1298 switch (type) { 1311 switch (type) {
1299 case P_PROMPT: 1312 case P_PROMPT:
1300 return "prompt"; 1313 return "prompt";
1301 case P_ENV:
1302 return "env";
1303 case P_COMMENT: 1314 case P_COMMENT:
1304 return "comment"; 1315 return "comment";
1305 case P_MENU: 1316 case P_MENU:
diff --git a/scripts/kconfig/tests/warn_recursive_dep/Kconfig b/scripts/kconfig/tests/err_recursive_dep/Kconfig
index a65bfcb7137e..ebdb3ffd8717 100644
--- a/scripts/kconfig/tests/warn_recursive_dep/Kconfig
+++ b/scripts/kconfig/tests/err_recursive_dep/Kconfig
@@ -1,3 +1,5 @@
1# SPDX-License-Identifier: GPL-2.0
2
1# depends on itself 3# depends on itself
2 4
3config A 5config A
@@ -31,7 +33,6 @@ config D2
31 bool 33 bool
32 34
33# depends on and imply 35# depends on and imply
34# This is not recursive dependency
35 36
36config E1 37config E1
37 bool "E1" 38 bool "E1"
diff --git a/scripts/kconfig/tests/err_recursive_dep/__init__.py b/scripts/kconfig/tests/err_recursive_dep/__init__.py
new file mode 100644
index 000000000000..5f3821b43ce6
--- /dev/null
+++ b/scripts/kconfig/tests/err_recursive_dep/__init__.py
@@ -0,0 +1,10 @@
1# SPDX-License-Identifier: GPL-2.0
2"""
3Detect recursive dependency error.
4
5Recursive dependency should be treated as an error.
6"""
7
8def test(conf):
9 assert conf.oldaskconfig() == 1
10 assert conf.stderr_contains('expected_stderr')
diff --git a/scripts/kconfig/tests/err_recursive_dep/expected_stderr b/scripts/kconfig/tests/err_recursive_dep/expected_stderr
new file mode 100644
index 000000000000..84679b104655
--- /dev/null
+++ b/scripts/kconfig/tests/err_recursive_dep/expected_stderr
@@ -0,0 +1,38 @@
1Kconfig:11:error: recursive dependency detected!
2Kconfig:11: symbol B is selected by B
3For a resolution refer to Documentation/kbuild/kconfig-language.txt
4subsection "Kconfig recursive dependency limitations"
5
6Kconfig:5:error: recursive dependency detected!
7Kconfig:5: symbol A depends on A
8For a resolution refer to Documentation/kbuild/kconfig-language.txt
9subsection "Kconfig recursive dependency limitations"
10
11Kconfig:17:error: recursive dependency detected!
12Kconfig:17: symbol C1 depends on C2
13Kconfig:21: symbol C2 depends on C1
14For a resolution refer to Documentation/kbuild/kconfig-language.txt
15subsection "Kconfig recursive dependency limitations"
16
17Kconfig:32:error: recursive dependency detected!
18Kconfig:32: symbol D2 is selected by D1
19Kconfig:27: symbol D1 depends on D2
20For a resolution refer to Documentation/kbuild/kconfig-language.txt
21subsection "Kconfig recursive dependency limitations"
22
23Kconfig:37:error: recursive dependency detected!
24Kconfig:37: symbol E1 depends on E2
25Kconfig:42: symbol E2 is implied by E1
26For a resolution refer to Documentation/kbuild/kconfig-language.txt
27subsection "Kconfig recursive dependency limitations"
28
29Kconfig:60:error: recursive dependency detected!
30Kconfig:60: symbol G depends on G
31For a resolution refer to Documentation/kbuild/kconfig-language.txt
32subsection "Kconfig recursive dependency limitations"
33
34Kconfig:51:error: recursive dependency detected!
35Kconfig:51: symbol F2 depends on F1
36Kconfig:49: symbol F1 default value contains F2
37For a resolution refer to Documentation/kbuild/kconfig-language.txt
38subsection "Kconfig recursive dependency limitations"
diff --git a/scripts/kconfig/tests/warn_recursive_dep/__init__.py b/scripts/kconfig/tests/warn_recursive_dep/__init__.py
deleted file mode 100644
index adb21951ba41..000000000000
--- a/scripts/kconfig/tests/warn_recursive_dep/__init__.py
+++ /dev/null
@@ -1,9 +0,0 @@
1"""
2Warn recursive inclusion.
3
4Recursive dependency should be warned.
5"""
6
7def test(conf):
8 assert conf.oldaskconfig() == 0
9 assert conf.stderr_contains('expected_stderr')
diff --git a/scripts/kconfig/tests/warn_recursive_dep/expected_stderr b/scripts/kconfig/tests/warn_recursive_dep/expected_stderr
deleted file mode 100644
index 3de807dd9cb2..000000000000
--- a/scripts/kconfig/tests/warn_recursive_dep/expected_stderr
+++ /dev/null
@@ -1,30 +0,0 @@
1Kconfig:9:error: recursive dependency detected!
2Kconfig:9: symbol B is selected by B
3For a resolution refer to Documentation/kbuild/kconfig-language.txt
4subsection "Kconfig recursive dependency limitations"
5
6Kconfig:3:error: recursive dependency detected!
7Kconfig:3: symbol A depends on A
8For a resolution refer to Documentation/kbuild/kconfig-language.txt
9subsection "Kconfig recursive dependency limitations"
10
11Kconfig:15:error: recursive dependency detected!
12Kconfig:15: symbol C1 depends on C2
13Kconfig:19: symbol C2 depends on C1
14For a resolution refer to Documentation/kbuild/kconfig-language.txt
15subsection "Kconfig recursive dependency limitations"
16
17Kconfig:30:error: recursive dependency detected!
18Kconfig:30: symbol D2 is selected by D1
19Kconfig:25: symbol D1 depends on D2
20For a resolution refer to Documentation/kbuild/kconfig-language.txt
21subsection "Kconfig recursive dependency limitations"
22
23Kconfig:59:error: recursive dependency detected!
24Kconfig:59: symbol G depends on G
25For a resolution refer to Documentation/kbuild/kconfig-language.txt
26subsection "Kconfig recursive dependency limitations"
27
28Kconfig:50:error: recursive dependency detected!
29Kconfig:50: symbol F2 depends on F1
30Kconfig:48: symbol F1 default value contains F2
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index a365594770d9..d999683bb2a7 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -29,36 +29,6 @@ struct file *file_lookup(const char *name)
29 return file; 29 return file;
30} 30}
31 31
32/* write a dependency file as used by kbuild to track dependencies */
33int file_write_dep(const char *name)
34{
35 struct file *file;
36 FILE *out;
37
38 if (!name)
39 name = ".kconfig.d";
40 out = fopen("..config.tmp", "w");
41 if (!out)
42 return 1;
43 fprintf(out, "deps_config := \\\n");
44 for (file = file_list; file; file = file->next) {
45 if (file->next)
46 fprintf(out, "\t%s \\\n", file->name);
47 else
48 fprintf(out, "\t%s\n", file->name);
49 }
50 fprintf(out, "\n%s: \\\n"
51 "\t$(deps_config)\n\n", conf_get_autoconfig_name());
52
53 env_write_dep(out, conf_get_autoconfig_name());
54
55 fprintf(out, "\n$(deps_config): ;\n");
56 fclose(out);
57 rename("..config.tmp", name);
58 return 0;
59}
60
61
62/* Allocate initial growable string */ 32/* Allocate initial growable string */
63struct gstr str_new(void) 33struct gstr str_new(void)
64{ 34{
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 6f9b0aa32a82..22fceb264cf5 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -31,7 +31,7 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE];
31static struct menu *current_menu, *current_entry; 31static struct menu *current_menu, *current_entry;
32 32
33%} 33%}
34%expect 32 34%expect 30
35 35
36%union 36%union
37{ 37{
@@ -117,7 +117,7 @@ start: mainmenu_stmt stmt_list | stmt_list;
117 117
118/* mainmenu entry */ 118/* mainmenu entry */
119 119
120mainmenu_stmt: T_MAINMENU prompt nl 120mainmenu_stmt: T_MAINMENU prompt T_EOL
121{ 121{
122 menu_add_prompt(P_MENU, $2, NULL); 122 menu_add_prompt(P_MENU, $2, NULL);
123}; 123};
@@ -265,7 +265,7 @@ symbol_option_arg:
265choice: T_CHOICE word_opt T_EOL 265choice: T_CHOICE word_opt T_EOL
266{ 266{
267 struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE); 267 struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
268 sym->flags |= SYMBOL_AUTO; 268 sym->flags |= SYMBOL_NO_WRITE;
269 menu_add_entry(sym); 269 menu_add_entry(sym);
270 menu_add_expr(P_CHOICE, NULL, NULL); 270 menu_add_expr(P_CHOICE, NULL, NULL);
271 free($2); 271 free($2);
@@ -337,7 +337,7 @@ choice_block:
337 337
338/* if entry */ 338/* if entry */
339 339
340if_entry: T_IF expr nl 340if_entry: T_IF expr T_EOL
341{ 341{
342 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); 342 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
343 menu_add_entry(NULL); 343 menu_add_entry(NULL);
@@ -717,6 +717,10 @@ static void print_symbol(FILE *out, struct menu *menu)
717 print_quoted_string(out, prop->text); 717 print_quoted_string(out, prop->text);
718 fputc('\n', out); 718 fputc('\n', out);
719 break; 719 break;
720 case P_SYMBOL:
721 fputs( " symbol ", out);
722 fprintf(out, "%s\n", prop->sym->name);
723 break;
720 default: 724 default:
721 fprintf(out, " unknown prop %d!\n", prop->type); 725 fprintf(out, " unknown prop %d!\n", prop->type);
722 break; 726 break;
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 0057d8eafcc1..8f0f508a78e9 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1062,7 +1062,7 @@ sub dump_struct($$) {
1062 my $x = shift; 1062 my $x = shift;
1063 my $file = shift; 1063 my $file = shift;
1064 1064
1065 if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { 1065 if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}/) {
1066 my $decl_type = $1; 1066 my $decl_type = $1;
1067 $declaration_name = $2; 1067 $declaration_name = $2;
1068 my $members = $3; 1068 my $members = $3;
@@ -1148,20 +1148,20 @@ sub dump_struct($$) {
1148 } 1148 }
1149 } 1149 }
1150 } 1150 }
1151 $members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)}([^\{\}\;]*)\;/$newmember/; 1151 $members =~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;/$newmember/;
1152 } 1152 }
1153 1153
1154 # Ignore other nested elements, like enums 1154 # Ignore other nested elements, like enums
1155 $members =~ s/({[^\{\}]*})//g; 1155 $members =~ s/(\{[^\{\}]*\})//g;
1156 1156
1157 create_parameterlist($members, ';', $file, $declaration_name); 1157 create_parameterlist($members, ';', $file, $declaration_name);
1158 check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual); 1158 check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual);
1159 1159
1160 # Adjust declaration for better display 1160 # Adjust declaration for better display
1161 $declaration =~ s/([{;])/$1\n/g; 1161 $declaration =~ s/([\{;])/$1\n/g;
1162 $declaration =~ s/}\s+;/};/g; 1162 $declaration =~ s/\}\s+;/};/g;
1163 # Better handle inlined enums 1163 # Better handle inlined enums
1164 do {} while ($declaration =~ s/(enum\s+{[^}]+),([^\n])/$1,\n$2/); 1164 do {} while ($declaration =~ s/(enum\s+\{[^\}]+),([^\n])/$1,\n$2/);
1165 1165
1166 my @def_args = split /\n/, $declaration; 1166 my @def_args = split /\n/, $declaration;
1167 my $level = 1; 1167 my $level = 1;
@@ -1171,12 +1171,12 @@ sub dump_struct($$) {
1171 $clause =~ s/\s+$//; 1171 $clause =~ s/\s+$//;
1172 $clause =~ s/\s+/ /; 1172 $clause =~ s/\s+/ /;
1173 next if (!$clause); 1173 next if (!$clause);
1174 $level-- if ($clause =~ m/(})/ && $level > 1); 1174 $level-- if ($clause =~ m/(\})/ && $level > 1);
1175 if (!($clause =~ m/^\s*#/)) { 1175 if (!($clause =~ m/^\s*#/)) {
1176 $declaration .= "\t" x $level; 1176 $declaration .= "\t" x $level;
1177 } 1177 }
1178 $declaration .= "\t" . $clause . "\n"; 1178 $declaration .= "\t" . $clause . "\n";
1179 $level++ if ($clause =~ m/({)/ && !($clause =~m/}/)); 1179 $level++ if ($clause =~ m/(\{)/ && !($clause =~m/\}/));
1180 } 1180 }
1181 output_declaration($declaration_name, 1181 output_declaration($declaration_name,
1182 'struct', 1182 'struct',
@@ -1244,7 +1244,7 @@ sub dump_enum($$) {
1244 # strip #define macros inside enums 1244 # strip #define macros inside enums
1245 $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos; 1245 $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
1246 1246
1247 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { 1247 if ($x =~ /enum\s+(\w+)\s*\{(.*)\}/) {
1248 $declaration_name = $1; 1248 $declaration_name = $1;
1249 my $members = $2; 1249 my $members = $2;
1250 my %_members; 1250 my %_members;
@@ -1785,7 +1785,7 @@ sub process_proto_type($$) {
1785 } 1785 }
1786 1786
1787 while (1) { 1787 while (1) {
1788 if ( $x =~ /([^{};]*)([{};])(.*)/ ) { 1788 if ( $x =~ /([^\{\};]*)([\{\};])(.*)/ ) {
1789 if( length $prototype ) { 1789 if( length $prototype ) {
1790 $prototype .= " " 1790 $prototype .= " "
1791 } 1791 }
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 4bf811c09f59..c8cf45362bd6 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -75,7 +75,7 @@ modpost_link()
75 ${KBUILD_VMLINUX_LIBS} \ 75 ${KBUILD_VMLINUX_LIBS} \
76 --end-group" 76 --end-group"
77 77
78 ${LD} ${LDFLAGS} -r -o ${1} ${objects} 78 ${LD} ${KBUILD_LDFLAGS} -r -o ${1} ${objects}
79} 79}
80 80
81# Link of vmlinux 81# Link of vmlinux
@@ -95,7 +95,7 @@ vmlinux_link()
95 --end-group \ 95 --end-group \
96 ${1}" 96 ${1}"
97 97
98 ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ 98 ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \
99 -T ${lds} ${objects} 99 -T ${lds} ${objects}
100 else 100 else
101 objects="-Wl,--whole-archive \ 101 objects="-Wl,--whole-archive \
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index 6667f7b491d6..293004499b4d 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -221,5 +221,9 @@ int main(void)
221 DEVID_FIELD(tb_service_id, protocol_version); 221 DEVID_FIELD(tb_service_id, protocol_version);
222 DEVID_FIELD(tb_service_id, protocol_revision); 222 DEVID_FIELD(tb_service_id, protocol_revision);
223 223
224 DEVID(typec_device_id);
225 DEVID_FIELD(typec_device_id, svid);
226 DEVID_FIELD(typec_device_id, mode);
227
224 return 0; 228 return 0;
225} 229}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 52fd54a8fe39..7be43697ff84 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1352,6 +1352,19 @@ static int do_tbsvc_entry(const char *filename, void *symval, char *alias)
1352} 1352}
1353ADD_TO_DEVTABLE("tbsvc", tb_service_id, do_tbsvc_entry); 1353ADD_TO_DEVTABLE("tbsvc", tb_service_id, do_tbsvc_entry);
1354 1354
1355/* Looks like: typec:idNmN */
1356static int do_typec_entry(const char *filename, void *symval, char *alias)
1357{
1358 DEF_FIELD(symval, typec_device_id, svid);
1359 DEF_FIELD(symval, typec_device_id, mode);
1360
1361 sprintf(alias, "typec:id%04X", svid);
1362 ADD(alias, "m", mode != TYPEC_ANY_MODE, mode);
1363
1364 return 1;
1365}
1366ADD_TO_DEVTABLE("typec", typec_device_id, do_typec_entry);
1367
1355/* Does namelen bytes of name exactly match the symbol? */ 1368/* Does namelen bytes of name exactly match the symbol? */
1356static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1369static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1357{ 1370{
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 1663fb19343a..0d998c54564d 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -672,7 +672,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
672 if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) 672 if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER)
673 break; 673 break;
674 if (symname[0] == '.') { 674 if (symname[0] == '.') {
675 char *munged = strdup(symname); 675 char *munged = NOFAIL(strdup(symname));
676 munged[0] = '_'; 676 munged[0] = '_';
677 munged[1] = toupper(munged[1]); 677 munged[1] = toupper(munged[1]);
678 symname = munged; 678 symname = munged;
@@ -1318,7 +1318,7 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
1318static char *sec2annotation(const char *s) 1318static char *sec2annotation(const char *s)
1319{ 1319{
1320 if (match(s, init_exit_sections)) { 1320 if (match(s, init_exit_sections)) {
1321 char *p = malloc(20); 1321 char *p = NOFAIL(malloc(20));
1322 char *r = p; 1322 char *r = p;
1323 1323
1324 *p++ = '_'; 1324 *p++ = '_';
@@ -1338,7 +1338,7 @@ static char *sec2annotation(const char *s)
1338 strcat(p, " "); 1338 strcat(p, " ");
1339 return r; 1339 return r;
1340 } else { 1340 } else {
1341 return strdup(""); 1341 return NOFAIL(strdup(""));
1342 } 1342 }
1343} 1343}
1344 1344
@@ -2036,7 +2036,7 @@ void buf_write(struct buffer *buf, const char *s, int len)
2036{ 2036{
2037 if (buf->size - buf->pos < len) { 2037 if (buf->size - buf->pos < len) {
2038 buf->size += len + SZ; 2038 buf->size += len + SZ;
2039 buf->p = realloc(buf->p, buf->size); 2039 buf->p = NOFAIL(realloc(buf->p, buf->size));
2040 } 2040 }
2041 strncpy(buf->p + buf->pos, s, len); 2041 strncpy(buf->p + buf->pos, s, len);
2042 buf->pos += len; 2042 buf->pos += len;
@@ -2125,10 +2125,13 @@ static int check_modname_len(struct module *mod)
2125 **/ 2125 **/
2126static void add_header(struct buffer *b, struct module *mod) 2126static void add_header(struct buffer *b, struct module *mod)
2127{ 2127{
2128 buf_printf(b, "#include <linux/build-salt.h>\n");
2128 buf_printf(b, "#include <linux/module.h>\n"); 2129 buf_printf(b, "#include <linux/module.h>\n");
2129 buf_printf(b, "#include <linux/vermagic.h>\n"); 2130 buf_printf(b, "#include <linux/vermagic.h>\n");
2130 buf_printf(b, "#include <linux/compiler.h>\n"); 2131 buf_printf(b, "#include <linux/compiler.h>\n");
2131 buf_printf(b, "\n"); 2132 buf_printf(b, "\n");
2133 buf_printf(b, "BUILD_SALT;\n");
2134 buf_printf(b, "\n");
2132 buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); 2135 buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
2133 buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n"); 2136 buf_printf(b, "MODULE_INFO(name, KBUILD_MODNAME);\n");
2134 buf_printf(b, "\n"); 2137 buf_printf(b, "\n");
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index e8cc72a51b32..d624a07a4e77 100755
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -84,10 +84,6 @@ case "${ARCH}" in
84 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 84 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
85 [ -f "${objtree}/lifimage" ] && cp -v -- "${objtree}/lifimage" "${tmpdir}/boot/lifimage-${KERNELRELEASE}" 85 [ -f "${objtree}/lifimage" ] && cp -v -- "${objtree}/lifimage" "${tmpdir}/boot/lifimage-${KERNELRELEASE}"
86 ;; 86 ;;
87 vax)
88 [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS"
89 [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk"
90 ;;
91 mips) 87 mips)
92 if [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.bin" ]; then 88 if [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.bin" ]; then
93 cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.bin" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" 89 cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.bin" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
@@ -109,6 +105,14 @@ case "${ARCH}" in
109 cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" 105 cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
110 fi 106 fi
111 ;; 107 ;;
108 arm64)
109 for i in Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo ; do
110 if [ -f "${objtree}/arch/arm64/boot/${i}" ] ; then
111 cp -v -- "${objtree}/arch/arm64/boot/${i}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
112 break
113 fi
114 done
115 ;;
112 *) 116 *)
113 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}" 117 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}"
114 echo "" >&2 118 echo "" >&2
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 985d72d1ab34..663a7f343b42 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -6,49 +6,81 @@
6 6
7set -e 7set -e
8 8
9is_enabled() {
10 grep -q "^CONFIG_$1=y" $KCONFIG_CONFIG
11}
12
13if_enabled_echo() {
14 if is_enabled "$1"; then
15 echo -n "$2"
16 elif [ $# -ge 3 ]; then
17 echo -n "$3"
18 fi
19}
20
9set_debarch() { 21set_debarch() {
22 if [ -n "$KBUILD_DEBARCH" ] ; then
23 debarch="$KBUILD_DEBARCH"
24 return
25 fi
26
10 # Attempt to find the correct Debian architecture 27 # Attempt to find the correct Debian architecture
11 case "$UTS_MACHINE" in 28 case "$UTS_MACHINE" in
12 i386|ia64|alpha) 29 i386|ia64|alpha|m68k|riscv*)
13 debarch="$UTS_MACHINE" ;; 30 debarch="$UTS_MACHINE" ;;
14 x86_64) 31 x86_64)
15 debarch=amd64 ;; 32 debarch=amd64 ;;
16 sparc*) 33 sparc*)
17 debarch=sparc ;; 34 debarch=sparc$(if_enabled_echo 64BIT 64) ;;
18 s390*) 35 s390*)
19 debarch=s390$(grep -q CONFIG_64BIT=y $KCONFIG_CONFIG && echo x || true) ;; 36 debarch=s390x ;;
20 ppc*) 37 ppc*)
21 debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;; 38 if is_enabled 64BIT; then
39 debarch=ppc64$(if_enabled_echo CPU_LITTLE_ENDIAN el)
40 else
41 debarch=powerpc$(if_enabled_echo SPE spe)
42 fi
43 ;;
22 parisc*) 44 parisc*)
23 debarch=hppa ;; 45 debarch=hppa ;;
24 mips*) 46 mips*)
25 debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;; 47 if is_enabled CPU_LITTLE_ENDIAN; then
48 debarch=mips$(if_enabled_echo 64BIT 64)$(if_enabled_echo CPU_MIPSR6 r6)el
49 elif is_enabled CPU_MIPSR6; then
50 debarch=mips$(if_enabled_echo 64BIT 64)r6
51 else
52 debarch=mips
53 fi
54 ;;
26 aarch64|arm64) 55 aarch64|arm64)
27 debarch=arm64 ;; 56 debarch=arm64 ;;
28 arm*) 57 arm*)
29 if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then 58 if is_enabled AEABI; then
30 if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then 59 debarch=arm$(if_enabled_echo VFP hf el)
31 debarch=armhf
32 else
33 debarch=armel
34 fi
35 else 60 else
36 debarch=arm 61 debarch=arm
62 fi
63 ;;
64 openrisc)
65 debarch=or1k ;;
66 sh)
67 if is_enabled CPU_SH3; then
68 debarch=sh3$(if_enabled_echo CPU_BIG_ENDIAN eb)
69 elif is_enabled CPU_SH4; then
70 debarch=sh4$(if_enabled_echo CPU_BIG_ENDIAN eb)
37 fi 71 fi
38 ;; 72 ;;
39 *) 73 esac
40 debarch=$(dpkg --print-architecture) 74 if [ -z "$debarch" ]; then
75 debarch=$(dpkg-architecture -qDEB_HOST_ARCH)
41 echo "" >&2 76 echo "" >&2
42 echo "** ** ** WARNING ** ** **" >&2 77 echo "** ** ** WARNING ** ** **" >&2
43 echo "" >&2 78 echo "" >&2
44 echo "Your architecture doesn't have its equivalent" >&2 79 echo "Your architecture doesn't have its equivalent" >&2
45 echo "Debian userspace architecture defined!" >&2 80 echo "Debian userspace architecture defined!" >&2
46 echo "Falling back to using your current userspace instead!" >&2 81 echo "Falling back to the current host architecture ($debarch)." >&2
47 echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 82 echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
48 echo "" >&2 83 echo "" >&2
49 esac
50 if [ -n "$KBUILD_DEBARCH" ] ; then
51 debarch="$KBUILD_DEBARCH"
52 fi 84 fi
53} 85}
54 86
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index 7deaef297f52..839e190bbd7a 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -4,6 +4,7 @@
4 4
5from argparse import ArgumentParser 5from argparse import ArgumentParser
6from ply import lex, yacc 6from ply import lex, yacc
7import locale
7import traceback 8import traceback
8import sys 9import sys
9import git 10import git
@@ -32,7 +33,7 @@ def read_spdxdata(repo):
32 33
33 # The subdirectories of LICENSES in the kernel source 34 # The subdirectories of LICENSES in the kernel source
34 license_dirs = [ "preferred", "other", "exceptions" ] 35 license_dirs = [ "preferred", "other", "exceptions" ]
35 lictree = repo.heads.master.commit.tree['LICENSES'] 36 lictree = repo.head.commit.tree['LICENSES']
36 37
37 spdx = SPDXdata() 38 spdx = SPDXdata()
38 39
@@ -102,7 +103,7 @@ class id_parser(object):
102 raise ParserException(tok, 'Invalid License ID') 103 raise ParserException(tok, 'Invalid License ID')
103 self.lastid = id 104 self.lastid = id
104 elif tok.type == 'EXC': 105 elif tok.type == 'EXC':
105 if not self.spdx.exceptions.has_key(id): 106 if id not in self.spdx.exceptions:
106 raise ParserException(tok, 'Invalid Exception ID') 107 raise ParserException(tok, 'Invalid Exception ID')
107 if self.lastid not in self.spdx.exceptions[id]: 108 if self.lastid not in self.spdx.exceptions[id]:
108 raise ParserException(tok, 'Exception not valid for license %s' %self.lastid) 109 raise ParserException(tok, 'Exception not valid for license %s' %self.lastid)
@@ -167,6 +168,7 @@ class id_parser(object):
167 self.curline = 0 168 self.curline = 0
168 try: 169 try:
169 for line in fd: 170 for line in fd:
171 line = line.decode(locale.getpreferredencoding(False), errors='ignore')
170 self.curline += 1 172 self.curline += 1
171 if self.curline > maxlines: 173 if self.curline > maxlines:
172 break 174 break
@@ -199,11 +201,10 @@ def scan_git_tree(tree):
199 continue 201 continue
200 if el.path.find("license-rules.rst") >= 0: 202 if el.path.find("license-rules.rst") >= 0:
201 continue 203 continue
202 if el.path == 'scripts/checkpatch.pl':
203 continue
204 if not os.path.isfile(el.path): 204 if not os.path.isfile(el.path):
205 continue 205 continue
206 parser.parse_lines(open(el.path), args.maxlines, el.path) 206 with open(el.path, 'rb') as fd:
207 parser.parse_lines(fd, args.maxlines, el.path)
207 208
208def scan_git_subtree(tree, path): 209def scan_git_subtree(tree, path):
209 for p in path.strip('/').split('/'): 210 for p in path.strip('/').split('/'):
diff --git a/scripts/spelling.txt b/scripts/spelling.txt
index 9a058cff49d4..517d0c3f83df 100644
--- a/scripts/spelling.txt
+++ b/scripts/spelling.txt
@@ -10,6 +10,8 @@
10abandonning||abandoning 10abandonning||abandoning
11abigious||ambiguous 11abigious||ambiguous
12abitrate||arbitrate 12abitrate||arbitrate
13abord||abort
14aboslute||absolute
13abov||above 15abov||above
14abreviated||abbreviated 16abreviated||abbreviated
15absense||absence 17absense||absence
@@ -25,6 +27,7 @@ accessable||accessible
25accesss||access 27accesss||access
26accidentaly||accidentally 28accidentaly||accidentally
27accidentually||accidentally 29accidentually||accidentally
30acclerated||accelerated
28accoding||according 31accoding||according
29accomodate||accommodate 32accomodate||accommodate
30accomodates||accommodates 33accomodates||accommodates
@@ -58,12 +61,15 @@ addres||address
58adddress||address 61adddress||address
59addreses||addresses 62addreses||addresses
60addresss||address 63addresss||address
64addrress||address
61aditional||additional 65aditional||additional
62aditionally||additionally 66aditionally||additionally
63aditionaly||additionally 67aditionaly||additionally
64adminstrative||administrative 68adminstrative||administrative
65adress||address 69adress||address
66adresses||addresses 70adresses||addresses
71adrresses||addresses
72advertisment||advertisement
67adviced||advised 73adviced||advised
68afecting||affecting 74afecting||affecting
69againt||against 75againt||against
@@ -100,6 +106,7 @@ alue||value
100ambigious||ambiguous 106ambigious||ambiguous
101amoung||among 107amoung||among
102amout||amount 108amout||amount
109amplifer||amplifier
103an union||a union 110an union||a union
104an user||a user 111an user||a user
105an userspace||a userspace 112an userspace||a userspace
@@ -145,11 +152,15 @@ assistent||assistant
145assocation||association 152assocation||association
146associcated||associated 153associcated||associated
147assotiated||associated 154assotiated||associated
155asssert||assert
148assum||assume 156assum||assume
149assumtpion||assumption 157assumtpion||assumption
150asuming||assuming 158asuming||assuming
151asycronous||asynchronous 159asycronous||asynchronous
152asynchnous||asynchronous 160asynchnous||asynchronous
161asynchromous||asynchronous
162asymetric||asymmetric
163asymmeric||asymmetric
153atomatically||automatically 164atomatically||automatically
154atomicly||atomically 165atomicly||atomically
155atempt||attempt 166atempt||attempt
@@ -172,6 +183,7 @@ avaible||available
172availabe||available 183availabe||available
173availabled||available 184availabled||available
174availablity||availability 185availablity||availability
186availaible||available
175availale||available 187availale||available
176availavility||availability 188availavility||availability
177availble||available 189availble||available
@@ -206,8 +218,11 @@ borad||board
206boundry||boundary 218boundry||boundary
207brievely||briefly 219brievely||briefly
208broadcat||broadcast 220broadcat||broadcast
221bufufer||buffer
209cacluated||calculated 222cacluated||calculated
223caculate||calculate
210caculation||calculation 224caculation||calculation
225cadidate||candidate
211calender||calendar 226calender||calendar
212calescing||coalescing 227calescing||coalescing
213calle||called 228calle||called
@@ -221,12 +236,14 @@ capabilty||capability
221capabitilies||capabilities 236capabitilies||capabilities
222capatibilities||capabilities 237capatibilities||capabilities
223capapbilities||capabilities 238capapbilities||capabilities
239caputure||capture
224carefuly||carefully 240carefuly||carefully
225cariage||carriage 241cariage||carriage
226catagory||category 242catagory||category
227cehck||check 243cehck||check
228challange||challenge 244challange||challenge
229challanges||challenges 245challanges||challenges
246chache||cache
230chanell||channel 247chanell||channel
231changable||changeable 248changable||changeable
232chanined||chained 249chanined||chained
@@ -240,6 +257,7 @@ charaters||characters
240charcter||character 257charcter||character
241chcek||check 258chcek||check
242chck||check 259chck||check
260checksumed||checksummed
243checksuming||checksumming 261checksuming||checksumming
244childern||children 262childern||children
245childs||children 263childs||children
@@ -292,8 +310,10 @@ comunication||communication
292conbination||combination 310conbination||combination
293conditionaly||conditionally 311conditionaly||conditionally
294conected||connected 312conected||connected
313conector||connector
295connecetd||connected 314connecetd||connected
296configuartion||configuration 315configuartion||configuration
316configuation||configuration
297configuratoin||configuration 317configuratoin||configuration
298configuraton||configuration 318configuraton||configuration
299configuretion||configuration 319configuretion||configuration
@@ -315,6 +335,7 @@ continous||continuous
315continously||continuously 335continously||continuously
316continueing||continuing 336continueing||continuing
317contraints||constraints 337contraints||constraints
338contruct||construct
318contol||control 339contol||control
319contoller||controller 340contoller||controller
320controled||controlled 341controled||controlled
@@ -343,6 +364,7 @@ dafault||default
343deafult||default 364deafult||default
344deamon||daemon 365deamon||daemon
345decompres||decompress 366decompres||decompress
367decsribed||described
346decription||description 368decription||description
347dectected||detected 369dectected||detected
348defailt||default 370defailt||default
@@ -379,6 +401,7 @@ desctiptor||descriptor
379desriptor||descriptor 401desriptor||descriptor
380desriptors||descriptors 402desriptors||descriptors
381destionation||destination 403destionation||destination
404destoried||destroyed
382destory||destroy 405destory||destroy
383destoryed||destroyed 406destoryed||destroyed
384destorys||destroys 407destorys||destroys
@@ -400,22 +423,30 @@ didnt||didn't
400diferent||different 423diferent||different
401differrence||difference 424differrence||difference
402diffrent||different 425diffrent||different
426differenciate||differentiate
403diffrentiate||differentiate 427diffrentiate||differentiate
404difinition||definition 428difinition||definition
405dimesions||dimensions 429dimesions||dimensions
406diplay||display 430diplay||display
431directon||direction
407direectly||directly 432direectly||directly
433diregard||disregard
408disassocation||disassociation 434disassocation||disassociation
409disapear||disappear 435disapear||disappear
410disapeared||disappeared 436disapeared||disappeared
411disappared||disappeared 437disappared||disappeared
438disbale||disable
439disbaled||disabled
412disble||disable 440disble||disable
413disbled||disabled 441disbled||disabled
414disconnet||disconnect 442disconnet||disconnect
415discontinous||discontinuous 443discontinous||discontinuous
444disharge||discharge
416dispertion||dispersion 445dispertion||dispersion
417dissapears||disappears 446dissapears||disappears
418distiction||distinction 447distiction||distinction
448divisable||divisible
449divsiors||divisors
419docuentation||documentation 450docuentation||documentation
420documantation||documentation 451documantation||documentation
421documentaion||documentation 452documentaion||documentation
@@ -427,6 +458,7 @@ downlad||download
427downlads||downloads 458downlads||downloads
428druing||during 459druing||during
429dynmaic||dynamic 460dynmaic||dynamic
461eanable||enable
430easilly||easily 462easilly||easily
431ecspecially||especially 463ecspecially||especially
432edditable||editable 464edditable||editable
@@ -484,9 +516,12 @@ exprimental||experimental
484extened||extended 516extened||extended
485extensability||extensibility 517extensability||extensibility
486extention||extension 518extention||extension
519extenstion||extension
487extracter||extractor 520extracter||extractor
521faield||failed
488falied||failed 522falied||failed
489faild||failed 523faild||failed
524failer||failure
490faill||fail 525faill||fail
491failied||failed 526failied||failed
492faillure||failure 527faillure||failure
@@ -520,6 +555,7 @@ forseeable||foreseeable
520forse||force 555forse||force
521fortan||fortran 556fortan||fortran
522forwardig||forwarding 557forwardig||forwarding
558frambuffer||framebuffer
523framming||framing 559framming||framing
524framwork||framework 560framwork||framework
525frequncy||frequency 561frequncy||frequency
@@ -527,6 +563,7 @@ frome||from
527fucntion||function 563fucntion||function
528fuction||function 564fuction||function
529fuctions||functions 565fuctions||functions
566funcation||function
530funcion||function 567funcion||function
531functionallity||functionality 568functionallity||functionality
532functionaly||functionally 569functionaly||functionally
@@ -540,6 +577,7 @@ futrue||future
540gaurenteed||guaranteed 577gaurenteed||guaranteed
541generiously||generously 578generiously||generously
542genereate||generate 579genereate||generate
580genereted||generated
543genric||generic 581genric||generic
544globel||global 582globel||global
545grabing||grabbing 583grabing||grabbing
@@ -553,6 +591,7 @@ guarentee||guarantee
553halfs||halves 591halfs||halves
554hander||handler 592hander||handler
555handfull||handful 593handfull||handful
594hanlde||handle
556hanled||handled 595hanled||handled
557happend||happened 596happend||happened
558harware||hardware 597harware||hardware
@@ -561,6 +600,7 @@ helpfull||helpful
561hybernate||hibernate 600hybernate||hibernate
562hierachy||hierarchy 601hierachy||hierarchy
563hierarchie||hierarchy 602hierarchie||hierarchy
603homogenous||homogeneous
564howver||however 604howver||however
565hsould||should 605hsould||should
566hypervior||hypervisor 606hypervior||hypervisor
@@ -568,6 +608,8 @@ hypter||hyper
568identidier||identifier 608identidier||identifier
569iligal||illegal 609iligal||illegal
570illigal||illegal 610illigal||illegal
611illgal||illegal
612iomaped||iomapped
571imblance||imbalance 613imblance||imbalance
572immeadiately||immediately 614immeadiately||immediately
573immedaite||immediate 615immedaite||immediate
@@ -618,12 +660,15 @@ initation||initiation
618initators||initiators 660initators||initiators
619initialiazation||initialization 661initialiazation||initialization
620initializiation||initialization 662initializiation||initialization
663initialze||initialize
621initialzed||initialized 664initialzed||initialized
622initilization||initialization 665initilization||initialization
623initilize||initialize 666initilize||initialize
624inofficial||unofficial 667inofficial||unofficial
668inrerface||interface
625insititute||institute 669insititute||institute
626instal||install 670instal||install
671instanciate||instantiate
627instanciated||instantiated 672instanciated||instantiated
628inteface||interface 673inteface||interface
629integreated||integrated 674integreated||integrated
@@ -657,6 +702,7 @@ intregral||integral
657intrrupt||interrupt 702intrrupt||interrupt
658intterrupt||interrupt 703intterrupt||interrupt
659intuative||intuitive 704intuative||intuitive
705inavlid||invalid
660invaid||invalid 706invaid||invalid
661invald||invalid 707invald||invalid
662invalde||invalid 708invalde||invalid
@@ -683,6 +729,7 @@ langauge||language
683langugage||language 729langugage||language
684lauch||launch 730lauch||launch
685layed||laid 731layed||laid
732legnth||length
686leightweight||lightweight 733leightweight||lightweight
687lengh||length 734lengh||length
688lenght||length 735lenght||length
@@ -696,6 +743,7 @@ licenceing||licencing
696loggging||logging 743loggging||logging
697loggin||login 744loggin||login
698logile||logfile 745logile||logfile
746loobpack||loopback
699loosing||losing 747loosing||losing
700losted||lost 748losted||lost
701machinary||machinery 749machinary||machinery
@@ -703,6 +751,7 @@ maintainance||maintenance
703maintainence||maintenance 751maintainence||maintenance
704maintan||maintain 752maintan||maintain
705makeing||making 753makeing||making
754mailformed||malformed
706malplaced||misplaced 755malplaced||misplaced
707malplace||misplace 756malplace||misplace
708managable||manageable 757managable||manageable
@@ -710,6 +759,7 @@ managment||management
710mangement||management 759mangement||management
711manoeuvering||maneuvering 760manoeuvering||maneuvering
712mappping||mapping 761mappping||mapping
762matchs||matches
713mathimatical||mathematical 763mathimatical||mathematical
714mathimatic||mathematic 764mathimatic||mathematic
715mathimatics||mathematics 765mathimatics||mathematics
@@ -725,6 +775,7 @@ messsage||message
725messsages||messages 775messsages||messages
726micropone||microphone 776micropone||microphone
727microprocesspr||microprocessor 777microprocesspr||microprocessor
778migrateable||migratable
728milliseonds||milliseconds 779milliseonds||milliseconds
729minium||minimum 780minium||minimum
730minimam||minimum 781minimam||minimum
@@ -741,6 +792,7 @@ missmatch||mismatch
741miximum||maximum 792miximum||maximum
742mmnemonic||mnemonic 793mmnemonic||mnemonic
743mnay||many 794mnay||many
795modfiy||modify
744modulues||modules 796modulues||modules
745momery||memory 797momery||memory
746memomry||memory 798memomry||memory
@@ -777,6 +829,7 @@ notifed||notified
777numebr||number 829numebr||number
778numner||number 830numner||number
779obtaion||obtain 831obtaion||obtain
832obusing||abusing
780occassionally||occasionally 833occassionally||occasionally
781occationally||occasionally 834occationally||occasionally
782occurance||occurrence 835occurance||occurrence
@@ -787,6 +840,7 @@ occure||occurred
787occured||occurred 840occured||occurred
788occuring||occurring 841occuring||occurring
789offet||offset 842offet||offset
843offloded||offloaded
790omited||omitted 844omited||omitted
791omiting||omitting 845omiting||omitting
792omitt||omit 846omitt||omit
@@ -829,6 +883,7 @@ parametes||parameters
829parametised||parametrised 883parametised||parametrised
830paramter||parameter 884paramter||parameter
831paramters||parameters 885paramters||parameters
886parmaters||parameters
832particuarly||particularly 887particuarly||particularly
833particularily||particularly 888particularily||particularly
834partiton||partition 889partiton||partition
@@ -837,6 +892,7 @@ passin||passing
837pathes||paths 892pathes||paths
838pecularities||peculiarities 893pecularities||peculiarities
839peformance||performance 894peformance||performance
895peforming||performing
840peice||piece 896peice||piece
841pendantic||pedantic 897pendantic||pedantic
842peprocessor||preprocessor 898peprocessor||preprocessor
@@ -846,6 +902,7 @@ peroid||period
846persistance||persistence 902persistance||persistence
847persistant||persistent 903persistant||persistent
848plalform||platform 904plalform||platform
905platfoem||platform
849platfrom||platform 906platfrom||platform
850plattform||platform 907plattform||platform
851pleaes||please 908pleaes||please
@@ -858,6 +915,7 @@ posible||possible
858positon||position 915positon||position
859possibilites||possibilities 916possibilites||possibilities
860powerfull||powerful 917powerfull||powerful
918preamle||preamble
861preample||preamble 919preample||preamble
862preapre||prepare 920preapre||prepare
863preceeded||preceded 921preceeded||preceded
@@ -870,6 +928,7 @@ prefered||preferred
870prefferably||preferably 928prefferably||preferably
871premption||preemption 929premption||preemption
872prepaired||prepared 930prepaired||prepared
931preperation||preparation
873pressre||pressure 932pressre||pressure
874primative||primitive 933primative||primitive
875princliple||principle 934princliple||principle
@@ -935,6 +994,7 @@ recommanded||recommended
935recyle||recycle 994recyle||recycle
936redircet||redirect 995redircet||redirect
937redirectrion||redirection 996redirectrion||redirection
997redundacy||redundancy
938reename||rename 998reename||rename
939refcounf||refcount 999refcounf||refcount
940refence||reference 1000refence||reference
@@ -945,6 +1005,7 @@ refernces||references
945refernnce||reference 1005refernnce||reference
946refrence||reference 1006refrence||reference
947registerd||registered 1007registerd||registered
1008registeration||registration
948registeresd||registered 1009registeresd||registered
949registerred||registered 1010registerred||registered
950registes||registers 1011registes||registers
@@ -973,7 +1034,9 @@ requirment||requirement
973requred||required 1034requred||required
974requried||required 1035requried||required
975requst||request 1036requst||request
1037reregisteration||reregistration
976reseting||resetting 1038reseting||resetting
1039reseverd||reserved
977resizeable||resizable 1040resizeable||resizable
978resouce||resource 1041resouce||resource
979resouces||resources 1042resouces||resources
@@ -982,6 +1045,7 @@ responce||response
982ressizes||resizes 1045ressizes||resizes
983ressource||resource 1046ressource||resource
984ressources||resources 1047ressources||resources
1048restesting||retesting
985retransmited||retransmitted 1049retransmited||retransmitted
986retreived||retrieved 1050retreived||retrieved
987retreive||retrieve 1051retreive||retrieve
@@ -1006,6 +1070,7 @@ sacrifying||sacrificing
1006safly||safely 1070safly||safely
1007safty||safety 1071safty||safety
1008savable||saveable 1072savable||saveable
1073scaleing||scaling
1009scaned||scanned 1074scaned||scanned
1010scaning||scanning 1075scaning||scanning
1011scarch||search 1076scarch||search
@@ -1014,6 +1079,8 @@ searchs||searches
1014secquence||sequence 1079secquence||sequence
1015secund||second 1080secund||second
1016segement||segment 1081segement||segment
1082semaphone||semaphore
1083senario||scenario
1017senarios||scenarios 1084senarios||scenarios
1018sentivite||sensitive 1085sentivite||sensitive
1019separatly||separately 1086separatly||separately
@@ -1025,9 +1092,13 @@ seperate||separate
1025seperatly||separately 1092seperatly||separately
1026seperator||separator 1093seperator||separator
1027sepperate||separate 1094sepperate||separate
1095seqeunce||sequence
1096seqeuncer||sequencer
1097seqeuencer||sequencer
1028sequece||sequence 1098sequece||sequence
1029sequencial||sequential 1099sequencial||sequential
1030serveral||several 1100serveral||several
1101servive||service
1031setts||sets 1102setts||sets
1032settting||setting 1103settting||setting
1033shotdown||shutdown 1104shotdown||shutdown
@@ -1073,6 +1144,7 @@ standartization||standardization
1073standart||standard 1144standart||standard
1074staticly||statically 1145staticly||statically
1075stoped||stopped 1146stoped||stopped
1147stoping||stopping
1076stoppped||stopped 1148stoppped||stopped
1077straming||streaming 1149straming||streaming
1078struc||struct 1150struc||struct
@@ -1085,6 +1157,7 @@ subdirectoires||subdirectories
1085suble||subtle 1157suble||subtle
1086substract||subtract 1158substract||subtract
1087submition||submission 1159submition||submission
1160suceed||succeed
1088succesfully||successfully 1161succesfully||successfully
1089succesful||successful 1162succesful||successful
1090successed||succeeded 1163successed||succeeded
@@ -1108,6 +1181,7 @@ surpressed||suppressed
1108surpresses||suppresses 1181surpresses||suppresses
1109susbsystem||subsystem 1182susbsystem||subsystem
1110suspeneded||suspended 1183suspeneded||suspended
1184suspsend||suspend
1111suspicously||suspiciously 1185suspicously||suspiciously
1112swaping||swapping 1186swaping||swapping
1113switchs||switches 1187switchs||switches
@@ -1122,6 +1196,7 @@ swtich||switch
1122symetric||symmetric 1196symetric||symmetric
1123synax||syntax 1197synax||syntax
1124synchonized||synchronized 1198synchonized||synchronized
1199synchronuously||synchronously
1125syncronize||synchronize 1200syncronize||synchronize
1126syncronized||synchronized 1201syncronized||synchronized
1127syncronizing||synchronizing 1202syncronizing||synchronizing
@@ -1130,11 +1205,14 @@ syste||system
1130sytem||system 1205sytem||system
1131sythesis||synthesis 1206sythesis||synthesis
1132taht||that 1207taht||that
1208tansmit||transmit
1133targetted||targeted 1209targetted||targeted
1134targetting||targeting 1210targetting||targeting
1211taskelt||tasklet
1135teh||the 1212teh||the
1136temorary||temporary 1213temorary||temporary
1137temproarily||temporarily 1214temproarily||temporarily
1215thead||thread
1138therfore||therefore 1216therfore||therefore
1139thier||their 1217thier||their
1140threds||threads 1218threds||threads
@@ -1143,11 +1221,14 @@ thresold||threshold
1143throught||through 1221throught||through
1144troughput||throughput 1222troughput||throughput
1145thses||these 1223thses||these
1224tiggers||triggers
1146tiggered||triggered 1225tiggered||triggered
1147tipically||typically 1226tipically||typically
1227timeing||timing
1148timout||timeout 1228timout||timeout
1149tmis||this 1229tmis||this
1150torerable||tolerable 1230torerable||tolerable
1231traking||tracking
1151tramsmitted||transmitted 1232tramsmitted||transmitted
1152tramsmit||transmit 1233tramsmit||transmit
1153tranasction||transaction 1234tranasction||transaction
@@ -1162,6 +1243,7 @@ transormed||transformed
1162trasfer||transfer 1243trasfer||transfer
1163trasmission||transmission 1244trasmission||transmission
1164treshold||threshold 1245treshold||threshold
1246trigerred||triggered
1165trigerring||triggering 1247trigerring||triggering
1166trun||turn 1248trun||turn
1167tunning||tuning 1249tunning||tuning
@@ -1169,6 +1251,8 @@ ture||true
1169tyep||type 1251tyep||type
1170udpate||update 1252udpate||update
1171uesd||used 1253uesd||used
1254uknown||unknown
1255usupported||unsupported
1172uncommited||uncommitted 1256uncommited||uncommitted
1173unconditionaly||unconditionally 1257unconditionaly||unconditionally
1174underun||underrun 1258underun||underrun
@@ -1181,11 +1265,14 @@ unexpeted||unexpected
1181unexpexted||unexpected 1265unexpexted||unexpected
1182unfortunatelly||unfortunately 1266unfortunatelly||unfortunately
1183unifiy||unify 1267unifiy||unify
1268uniterrupted||uninterrupted
1184unintialized||uninitialized 1269unintialized||uninitialized
1185unkmown||unknown 1270unkmown||unknown
1186unknonw||unknown 1271unknonw||unknown
1187unknow||unknown 1272unknow||unknown
1188unkown||unknown 1273unkown||unknown
1274unamed||unnamed
1275uneeded||unneeded
1189unneded||unneeded 1276unneded||unneeded
1190unneccecary||unnecessary 1277unneccecary||unnecessary
1191unneccesary||unnecessary 1278unneccesary||unnecessary
@@ -1210,6 +1297,7 @@ usefull||useful
1210usege||usage 1297usege||usage
1211usera||users 1298usera||users
1212usualy||usually 1299usualy||usually
1300usupported||unsupported
1213utilites||utilities 1301utilites||utilities
1214utillities||utilities 1302utillities||utilities
1215utilties||utilities 1303utilties||utilities
@@ -1233,7 +1321,9 @@ virtaul||virtual
1233virtiual||virtual 1321virtiual||virtual
1234visiters||visitors 1322visiters||visitors
1235vitual||virtual 1323vitual||virtual
1324vunerable||vulnerable
1236wakeus||wakeups 1325wakeus||wakeups
1326wathdog||watchdog
1237wating||waiting 1327wating||waiting
1238wiat||wait 1328wiat||wait
1239wether||whether 1329wether||whether
diff --git a/scripts/tags.sh b/scripts/tags.sh
index 66f08bb1cce9..26de7d5aa5c8 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -152,6 +152,7 @@ regex_asm=(
152) 152)
153regex_c=( 153regex_c=(
154 '/^SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/sys_\1/' 154 '/^SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/sys_\1/'
155 '/^BPF_CALL_[0-9](\([[:alnum:]_]*\).*/\1/'
155 '/^COMPAT_SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/compat_sys_\1/' 156 '/^COMPAT_SYSCALL_DEFINE[0-9](\([[:alnum:]_]*\).*/compat_sys_\1/'
156 '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1/' 157 '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1/'
157 '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1_rcuidle/' 158 '/^TRACE_EVENT(\([[:alnum:]_]*\).*/trace_\1_rcuidle/'
@@ -245,7 +246,7 @@ exuberant()
245{ 246{
246 setup_regex exuberant asm c 247 setup_regex exuberant asm c
247 all_target_sources | xargs $1 -a \ 248 all_target_sources | xargs $1 -a \
248 -I __initdata,__exitdata,__initconst, \ 249 -I __initdata,__exitdata,__initconst,__ro_after_init \
249 -I __initdata_memblock \ 250 -I __initdata_memblock \
250 -I __refdata,__attribute,__maybe_unused,__always_unused \ 251 -I __refdata,__attribute,__maybe_unused,__always_unused \
251 -I __acquires,__releases,__deprecated \ 252 -I __acquires,__releases,__deprecated \
diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py
index db40fa04cd51..9b6dd4f36335 100755
--- a/scripts/tracing/draw_functrace.py
+++ b/scripts/tracing/draw_functrace.py
@@ -123,7 +123,7 @@ def main():
123 tree = tree.getParent(caller) 123 tree = tree.getParent(caller)
124 tree = tree.calls(callee, calltime) 124 tree = tree.calls(callee, calltime)
125 125
126 print CallTree.ROOT 126 print(CallTree.ROOT)
127 127
128if __name__ == "__main__": 128if __name__ == "__main__":
129 main() 129 main()
diff --git a/scripts/ver_linux b/scripts/ver_linux
index 7227994ccf63..a6c728db05ce 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -32,11 +32,13 @@ BEGIN {
32 printversion("Nfs-utils", version("showmount --version")) 32 printversion("Nfs-utils", version("showmount --version"))
33 33
34 while (getline <"/proc/self/maps" > 0) { 34 while (getline <"/proc/self/maps" > 0) {
35 n = split($0, procmaps, "/") 35 if (/libc.*\.so$/) {
36 if (/libc.*so$/ && match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) { 36 n = split($0, procmaps, "/")
37 ver = substr(procmaps[n], RSTART, RLENGTH) 37 if (match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) {
38 printversion("Linux C Library", ver) 38 ver = substr(procmaps[n], RSTART, RLENGTH)
39 break 39 printversion("Linux C Library", ver)
40 break
41 }
40 } 42 }
41 } 43 }
42 44
@@ -68,7 +70,7 @@ BEGIN {
68function version(cmd, ver) { 70function version(cmd, ver) {
69 cmd = cmd " 2>&1" 71 cmd = cmd " 2>&1"
70 while (cmd | getline > 0) { 72 while (cmd | getline > 0) {
71 if (!/ver_linux/ && match($0, /[0-9]+([.]?[0-9]+)+/)) { 73 if (match($0, /[0-9]+([.]?[0-9]+)+/)) {
72 ver = substr($0, RSTART, RLENGTH) 74 ver = substr($0, RSTART, RLENGTH)
73 break 75 break
74 } 76 }