aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include4
-rwxr-xr-xscripts/checkstack.pl4
-rwxr-xr-xscripts/checksyscalls.sh1
-rw-r--r--scripts/coccinelle/api/drm-get-put.cocci78
-rw-r--r--scripts/gcc-plugins/stackleak_plugin.c8
-rw-r--r--scripts/mod/Makefile2
-rwxr-xr-xscripts/spdxcheck.py6
7 files changed, 13 insertions, 90 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index bb015551c2d9..3d09844405c9 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -115,9 +115,7 @@ __cc-option = $(call try-run,\
115 115
116# Do not attempt to build with gcc plugins during cc-option tests. 116# Do not attempt to build with gcc plugins during cc-option tests.
117# (And this uses delayed resolution so the flags will be up to date.) 117# (And this uses delayed resolution so the flags will be up to date.)
118# In addition, do not include the asm macros which are built later. 118CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
119CC_OPTION_FILTERED = $(GCC_PLUGINS_CFLAGS) $(ASM_MACRO_FLAGS)
120CC_OPTION_CFLAGS = $(filter-out $(CC_OPTION_FILTERED),$(KBUILD_CFLAGS))
121 119
122# cc-option 120# cc-option
123# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) 121# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index 8081b6cf67d2..34414c6efad6 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -47,8 +47,8 @@ my (@stack, $re, $dre, $x, $xs, $funcre);
47 $xs = "[0-9a-f ]"; # hex character or space 47 $xs = "[0-9a-f ]"; # hex character or space
48 $funcre = qr/^$x* <(.*)>:$/; 48 $funcre = qr/^$x* <(.*)>:$/;
49 if ($arch eq 'aarch64') { 49 if ($arch eq 'aarch64') {
50 #ffffffc0006325cc: a9bb7bfd stp x29, x30, [sp,#-80]! 50 #ffffffc0006325cc: a9bb7bfd stp x29, x30, [sp, #-80]!
51 $re = qr/^.*stp.*sp,\#-([0-9]{1,8})\]\!/o; 51 $re = qr/^.*stp.*sp, \#-([0-9]{1,8})\]\!/o;
52 } elsif ($arch eq 'arm') { 52 } elsif ($arch eq 'arm') {
53 #c0008ffc: e24dd064 sub sp, sp, #100 ; 0x64 53 #c0008ffc: e24dd064 sub sp, sp, #100 ; 0x64
54 $re = qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o; 54 $re = qr/.*sub.*sp, sp, #(([0-9]{2}|[3-9])[0-9]{2})/o;
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index ee3dfb5be6cd..cf931003395f 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -150,6 +150,7 @@ cat << EOF
150#define __IGNORE_uselib 150#define __IGNORE_uselib
151#define __IGNORE__sysctl 151#define __IGNORE__sysctl
152#define __IGNORE_arch_prctl 152#define __IGNORE_arch_prctl
153#define __IGNORE_nfsservctl
153 154
154/* ... including the "new" 32-bit uid syscalls */ 155/* ... including the "new" 32-bit uid syscalls */
155#define __IGNORE_lchown32 156#define __IGNORE_lchown32
diff --git a/scripts/coccinelle/api/drm-get-put.cocci b/scripts/coccinelle/api/drm-get-put.cocci
deleted file mode 100644
index 3a09c97ad87d..000000000000
--- a/scripts/coccinelle/api/drm-get-put.cocci
+++ /dev/null
@@ -1,78 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0
2///
3/// Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference() and
4/// drm_*_unreference() helpers.
5///
6// Confidence: High
7// Copyright: (C) 2017 NVIDIA Corporation
8// Options: --no-includes --include-headers
9//
10
11virtual patch
12virtual report
13
14@depends on patch@
15expression object;
16@@
17
18(
19- drm_connector_reference(object)
20+ drm_connector_get(object)
21|
22- drm_connector_unreference(object)
23+ drm_connector_put(object)
24|
25- drm_framebuffer_reference(object)
26+ drm_framebuffer_get(object)
27|
28- drm_framebuffer_unreference(object)
29+ drm_framebuffer_put(object)
30|
31- drm_gem_object_reference(object)
32+ drm_gem_object_get(object)
33|
34- drm_gem_object_unreference(object)
35+ drm_gem_object_put(object)
36|
37- __drm_gem_object_unreference(object)
38+ __drm_gem_object_put(object)
39|
40- drm_gem_object_unreference_unlocked(object)
41+ drm_gem_object_put_unlocked(object)
42|
43- drm_dev_unref(object)
44+ drm_dev_put(object)
45)
46
47@r depends on report@
48expression object;
49position p;
50@@
51
52(
53drm_connector_unreference@p(object)
54|
55drm_connector_reference@p(object)
56|
57drm_framebuffer_unreference@p(object)
58|
59drm_framebuffer_reference@p(object)
60|
61drm_gem_object_unreference@p(object)
62|
63drm_gem_object_reference@p(object)
64|
65__drm_gem_object_unreference(object)
66|
67drm_gem_object_unreference_unlocked(object)
68|
69drm_dev_unref@p(object)
70)
71
72@script:python depends on report@
73object << r.object;
74p << r.p;
75@@
76
77msg="WARNING: use get/put helpers to reference and dereference %s" % (object)
78coccilib.report.print_report(p[0], msg)
diff --git a/scripts/gcc-plugins/stackleak_plugin.c b/scripts/gcc-plugins/stackleak_plugin.c
index 2f48da98b5d4..dbd37460c573 100644
--- a/scripts/gcc-plugins/stackleak_plugin.c
+++ b/scripts/gcc-plugins/stackleak_plugin.c
@@ -363,10 +363,12 @@ __visible int plugin_init(struct plugin_name_args *plugin_info,
363 PASS_POS_INSERT_BEFORE); 363 PASS_POS_INSERT_BEFORE);
364 364
365 /* 365 /*
366 * The stackleak_cleanup pass should be executed after the 366 * The stackleak_cleanup pass should be executed before the "*free_cfg"
367 * "reload" pass, when the stack frame size is final. 367 * pass. It's the moment when the stack frame size is already final,
368 * function prologues and epilogues are generated, and the
369 * machine-dependent code transformations are not done.
368 */ 370 */
369 PASS_INFO(stackleak_cleanup, "reload", 1, PASS_POS_INSERT_AFTER); 371 PASS_INFO(stackleak_cleanup, "*free_cfg", 1, PASS_POS_INSERT_BEFORE);
370 372
371 if (!plugin_default_version_check(version, &gcc_version)) { 373 if (!plugin_default_version_check(version, &gcc_version)) {
372 error(G_("incompatible gcc/plugin versions")); 374 error(G_("incompatible gcc/plugin versions"));
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
index a5b4af47987a..42c5d50f2bcc 100644
--- a/scripts/mod/Makefile
+++ b/scripts/mod/Makefile
@@ -4,8 +4,6 @@ OBJECT_FILES_NON_STANDARD := y
4hostprogs-y := modpost mk_elfconfig 4hostprogs-y := modpost mk_elfconfig
5always := $(hostprogs-y) empty.o 5always := $(hostprogs-y) empty.o
6 6
7CFLAGS_REMOVE_empty.o := $(ASM_MACRO_FLAGS)
8
9modpost-objs := modpost.o file2alias.o sumversion.o 7modpost-objs := modpost.o file2alias.o sumversion.o
10 8
11devicetable-offsets-file := devicetable-offsets.h 9devicetable-offsets-file := devicetable-offsets.h
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index 5056fb3b897d..e559c6294c39 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -168,6 +168,7 @@ class id_parser(object):
168 self.curline = 0 168 self.curline = 0
169 try: 169 try:
170 for line in fd: 170 for line in fd:
171 line = line.decode(locale.getpreferredencoding(False), errors='ignore')
171 self.curline += 1 172 self.curline += 1
172 if self.curline > maxlines: 173 if self.curline > maxlines:
173 break 174 break
@@ -249,12 +250,13 @@ if __name__ == '__main__':
249 250
250 try: 251 try:
251 if len(args.path) and args.path[0] == '-': 252 if len(args.path) and args.path[0] == '-':
252 parser.parse_lines(sys.stdin, args.maxlines, '-') 253 stdin = os.fdopen(sys.stdin.fileno(), 'rb')
254 parser.parse_lines(stdin, args.maxlines, '-')
253 else: 255 else:
254 if args.path: 256 if args.path:
255 for p in args.path: 257 for p in args.path:
256 if os.path.isfile(p): 258 if os.path.isfile(p):
257 parser.parse_lines(open(p), args.maxlines, p) 259 parser.parse_lines(open(p, 'rb'), args.maxlines, p)
258 elif os.path.isdir(p): 260 elif os.path.isdir(p):
259 scan_git_subtree(repo.head.reference.commit.tree, p) 261 scan_git_subtree(repo.head.reference.commit.tree, p)
260 else: 262 else: