From 2eb9eabf1e868fda15808954fb29b0f105ed65f1 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 2 Nov 2017 00:47:19 +0000 Subject: KEYS: fix out-of-bounds read during ASN.1 parsing syzkaller with KASAN reported an out-of-bounds read in asn1_ber_decoder(). It can be reproduced by the following command, assuming CONFIG_X509_CERTIFICATE_PARSER=y and CONFIG_KASAN=y: keyctl add asymmetric desc $'\x30\x30' @s The bug is that the length of an ASN.1 data value isn't validated in the case where it is encoded using the short form, causing the decoder to read past the end of the input buffer. Fix it by validating the length. The bug report was: BUG: KASAN: slab-out-of-bounds in asn1_ber_decoder+0x10cb/0x1730 lib/asn1_decoder.c:233 Read of size 1 at addr ffff88003cccfa02 by task syz-executor0/6818 CPU: 1 PID: 6818 Comm: syz-executor0 Not tainted 4.14.0-rc7-00008-g5f479447d983 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:16 [inline] dump_stack+0xb3/0x10b lib/dump_stack.c:52 print_address_description+0x79/0x2a0 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x236/0x340 mm/kasan/report.c:409 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:427 asn1_ber_decoder+0x10cb/0x1730 lib/asn1_decoder.c:233 x509_cert_parse+0x1db/0x650 crypto/asymmetric_keys/x509_cert_parser.c:89 x509_key_preparse+0x64/0x7a0 crypto/asymmetric_keys/x509_public_key.c:174 asymmetric_key_preparse+0xcb/0x1a0 crypto/asymmetric_keys/asymmetric_type.c:388 key_create_or_update+0x347/0xb20 security/keys/key.c:855 SYSC_add_key security/keys/keyctl.c:122 [inline] SyS_add_key+0x1cd/0x340 security/keys/keyctl.c:62 entry_SYSCALL_64_fastpath+0x1f/0xbe RIP: 0033:0x447c89 RSP: 002b:00007fca7a5d3bd8 EFLAGS: 00000246 ORIG_RAX: 00000000000000f8 RAX: ffffffffffffffda RBX: 00007fca7a5d46cc RCX: 0000000000447c89 RDX: 0000000020006f4a RSI: 0000000020006000 RDI: 0000000020001ff5 RBP: 0000000000000046 R08: fffffffffffffffd R09: 0000000000000000 R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fca7a5d49c0 R15: 00007fca7a5d4700 Fixes: 42d5ec27f873 ("X.509: Add an ASN.1 decoder") Cc: # v3.7+ Signed-off-by: Eric Biggers Signed-off-by: David Howells Signed-off-by: James Morris --- lib/asn1_decoder.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c index 0bd8a611eb83..fef5d2e114be 100644 --- a/lib/asn1_decoder.c +++ b/lib/asn1_decoder.c @@ -284,6 +284,9 @@ next_op: if (unlikely(len > datalen - dp)) goto data_overrun_error; } + } else { + if (unlikely(len > datalen - dp)) + goto data_overrun_error; } if (flags & FLAG_CONS) { -- cgit From b24413180f5600bcb3bb70fbed5cf186b60864bd Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 1 Nov 2017 15:07:57 +0100 Subject: License cleanup: add SPDX GPL-2.0 license identifier to files with no license Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart Reviewed-by: Philippe Ombredanne Reviewed-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- lib/842/842.h | 1 + lib/842/842_debugfs.h | 1 + lib/Makefile | 1 + lib/argv_split.c | 1 + lib/audit.c | 1 + lib/bcd.c | 1 + lib/bug.c | 1 + lib/bust_spinlocks.c | 1 + lib/check_signature.c | 1 + lib/clz_tab.c | 1 + lib/compat_audit.c | 1 + lib/cpumask.c | 1 + lib/crc32defs.h | 1 + lib/ctype.c | 1 + lib/debug_info.c | 1 + lib/dec_and_lock.c | 1 + lib/decompress.c | 1 + lib/decompress_inflate.c | 1 + lib/devres.c | 1 + lib/div64.c | 1 + lib/dma-noop.c | 1 + lib/dma-virt.c | 1 + lib/dump_stack.c | 1 + lib/dynamic_queue_limits.c | 1 + lib/errseq.c | 1 + lib/flex_proportions.c | 1 + lib/fonts/Makefile | 1 + lib/fonts/font_10x18.c | 1 + lib/fonts/font_6x10.c | 1 + lib/fonts/font_6x11.c | 1 + lib/fonts/font_7x14.c | 1 + lib/fonts/font_8x16.c | 1 + lib/fonts/font_8x8.c | 1 + lib/fonts/font_acorn_8x8.c | 1 + lib/fonts/font_pearl_8x8.c | 1 + lib/fonts/font_sun12x22.c | 1 + lib/fonts/font_sun8x16.c | 1 + lib/gen_crc32table.c | 1 + lib/hweight.c | 1 + lib/inflate.c | 1 + lib/int_sqrt.c | 1 + lib/iomap.c | 1 + lib/iommu-common.c | 1 + lib/iommu-helper.c | 1 + lib/ioremap.c | 1 + lib/irq_poll.c | 1 + lib/kasprintf.c | 1 + lib/kstrtox.c | 1 + lib/kstrtox.h | 1 + lib/list_sort.c | 1 + lib/locking-selftest-hardirq.h | 1 + lib/locking-selftest-mutex.h | 1 + lib/locking-selftest-rlock.h | 1 + lib/locking-selftest-rsem.h | 1 + lib/locking-selftest-rtmutex.h | 1 + lib/locking-selftest-softirq.h | 1 + lib/locking-selftest-spin.h | 1 + lib/locking-selftest-wlock.h | 1 + lib/locking-selftest-wsem.h | 1 + lib/locking-selftest.c | 1 + lib/lockref.c | 1 + lib/lzo/lzodefs.h | 1 + lib/memweight.c | 1 + lib/mpi/Makefile | 1 + lib/net_utils.c | 1 + lib/nlattr.c | 1 + lib/nmi_backtrace.c | 1 + lib/nodemask.c | 1 + lib/notifier-error-inject.h | 1 + lib/once.c | 1 + lib/percpu_counter.c | 1 + lib/raid6/Makefile | 1 + lib/raid6/recov_s390xc.c | 1 + lib/raid6/s390vx.uc | 1 + lib/raid6/test/Makefile | 1 + lib/random32.c | 1 + lib/rational.c | 1 + lib/reciprocal_div.c | 1 + lib/refcount.c | 1 + lib/seq_buf.c | 1 + lib/sha1.c | 1 + lib/smp_processor_id.c | 1 + lib/sort.c | 1 + lib/string.c | 1 + lib/strncpy_from_user.c | 1 + lib/strnlen_user.c | 1 + lib/syscall.c | 1 + lib/ubsan.h | 1 + lib/ucs2_string.c | 1 + lib/usercopy.c | 1 + lib/win_minmax.c | 1 + 91 files changed, 91 insertions(+) (limited to 'lib') diff --git a/lib/842/842.h b/lib/842/842.h index e0a122bc1cdb..7b1f581a2907 100644 --- a/lib/842/842.h +++ b/lib/842/842.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __842_H__ #define __842_H__ diff --git a/lib/842/842_debugfs.h b/lib/842/842_debugfs.h index e7f3bffaf255..277e403e8701 100644 --- a/lib/842/842_debugfs.h +++ b/lib/842/842_debugfs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __842_DEBUGFS_H__ #define __842_DEBUGFS_H__ diff --git a/lib/Makefile b/lib/Makefile index dafa79613fb4..b8f2c16fccaa 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 # # Makefile for some libs needed in the kernel. # diff --git a/lib/argv_split.c b/lib/argv_split.c index e927ed0e18a8..5c35752a9414 100644 --- a/lib/argv_split.c +++ b/lib/argv_split.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Helper function for splitting a string into an argv-like array. */ diff --git a/lib/audit.c b/lib/audit.c index b8fb5ee81e26..5004bff928a7 100644 --- a/lib/audit.c +++ b/lib/audit.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/bcd.c b/lib/bcd.c index 40d304efe272..7e4750b6e801 100644 --- a/lib/bcd.c +++ b/lib/bcd.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include diff --git a/lib/bug.c b/lib/bug.c index a6a1137d06db..1e094408c893 100644 --- a/lib/bug.c +++ b/lib/bug.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* Generic support for BUG() diff --git a/lib/bust_spinlocks.c b/lib/bust_spinlocks.c index f8e0e5367398..ab719495e2cb 100644 --- a/lib/bust_spinlocks.c +++ b/lib/bust_spinlocks.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * lib/bust_spinlocks.c * diff --git a/lib/check_signature.c b/lib/check_signature.c index 6b49797980c4..43a7301da7ab 100644 --- a/lib/check_signature.c +++ b/lib/check_signature.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include diff --git a/lib/clz_tab.c b/lib/clz_tab.c index 7287b4a991a7..b6118d09f244 100644 --- a/lib/clz_tab.c +++ b/lib/clz_tab.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 const unsigned char __clz_tab[] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, diff --git a/lib/compat_audit.c b/lib/compat_audit.c index 873f75b640ab..77eabad69b4a 100644 --- a/lib/compat_audit.c +++ b/lib/compat_audit.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/cpumask.c b/lib/cpumask.c index 8b1a1bd77539..35fe142ebb5e 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/crc32defs.h b/lib/crc32defs.h index 64cba2c3c700..cb275a28a750 100644 --- a/lib/crc32defs.h +++ b/lib/crc32defs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * There are multiple 16-bit CRC polynomials in common use, but this is * *the* standard CRC-32 polynomial, first popularized by Ethernet. diff --git a/lib/ctype.c b/lib/ctype.c index c646df91a2f7..c819fe269eb2 100644 --- a/lib/ctype.c +++ b/lib/ctype.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/lib/ctype.c * diff --git a/lib/debug_info.c b/lib/debug_info.c index 2edbe27517ed..36daf753293c 100644 --- a/lib/debug_info.c +++ b/lib/debug_info.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * This file exists solely to ensure debug information for some core * data structures is included in the final image even for diff --git a/lib/dec_and_lock.c b/lib/dec_and_lock.c index e26278576b31..347fa7ac2e8a 100644 --- a/lib/dec_and_lock.c +++ b/lib/dec_and_lock.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/decompress.c b/lib/decompress.c index 62696dff5730..857ab1af1ef3 100644 --- a/lib/decompress.c +++ b/lib/decompress.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * decompress.c * diff --git a/lib/decompress_inflate.c b/lib/decompress_inflate.c index 555c06bf20da..63b4b7eee138 100644 --- a/lib/decompress_inflate.c +++ b/lib/decompress_inflate.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #ifdef STATIC #define PREBOOT /* Pre-boot environment: included */ diff --git a/lib/devres.c b/lib/devres.c index 78eca713b1d9..5f2aedd58bc5 100644 --- a/lib/devres.c +++ b/lib/devres.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/div64.c b/lib/div64.c index 7f345259c32f..58e2a404097e 100644 --- a/lib/div64.c +++ b/lib/div64.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2003 Bernardo Innocenti * diff --git a/lib/dma-noop.c b/lib/dma-noop.c index acc4190e2731..a10185b0c2d4 100644 --- a/lib/dma-noop.c +++ b/lib/dma-noop.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * lib/dma-noop.c * diff --git a/lib/dma-virt.c b/lib/dma-virt.c index 5c4f11329721..8e61a02ef9ca 100644 --- a/lib/dma-virt.c +++ b/lib/dma-virt.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * lib/dma-virt.c * diff --git a/lib/dump_stack.c b/lib/dump_stack.c index 625375e7f11f..c5edbedd364d 100644 --- a/lib/dump_stack.c +++ b/lib/dump_stack.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Provide a default dump_stack() function for architectures * which don't implement their own. diff --git a/lib/dynamic_queue_limits.c b/lib/dynamic_queue_limits.c index f346715e2255..6a406fafb5d6 100644 --- a/lib/dynamic_queue_limits.c +++ b/lib/dynamic_queue_limits.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Dynamic byte queue limits. See include/linux/dynamic_queue_limits.h * diff --git a/lib/errseq.c b/lib/errseq.c index 7b900c2a277a..79cc66897db4 100644 --- a/lib/errseq.c +++ b/lib/errseq.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/flex_proportions.c b/lib/flex_proportions.c index 2cc1f94e03a1..7852bfff50b1 100644 --- a/lib/flex_proportions.c +++ b/lib/flex_proportions.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Floating proportions with flexible aging period * diff --git a/lib/fonts/Makefile b/lib/fonts/Makefile index e04d010cfbf5..d56f02dea83a 100644 --- a/lib/fonts/Makefile +++ b/lib/fonts/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 # Font handling font-objs := fonts.o diff --git a/lib/fonts/font_10x18.c b/lib/fonts/font_10x18.c index 6be72bb218ee..532f0ff89a96 100644 --- a/lib/fonts/font_10x18.c +++ b/lib/fonts/font_10x18.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /******************************** * adapted from font_sun12x22.c * * by Jurriaan Kalkman 06-2005 * diff --git a/lib/fonts/font_6x10.c b/lib/fonts/font_6x10.c index b20620904d31..09b2cc03435b 100644 --- a/lib/fonts/font_6x10.c +++ b/lib/fonts/font_6x10.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include static const unsigned char fontdata_6x10[] = { diff --git a/lib/fonts/font_6x11.c b/lib/fonts/font_6x11.c index 46e86e67aa6a..d7136c33f1f0 100644 --- a/lib/fonts/font_6x11.c +++ b/lib/fonts/font_6x11.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /**********************************************/ /* */ /* Font file generated by rthelen */ diff --git a/lib/fonts/font_7x14.c b/lib/fonts/font_7x14.c index 3b7dbf9c060b..9ae5b62c8a0d 100644 --- a/lib/fonts/font_7x14.c +++ b/lib/fonts/font_7x14.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /**************************************/ /* this file adapted from font_8x16.c */ /* by Jurriaan Kalkman 05-2005 */ diff --git a/lib/fonts/font_8x16.c b/lib/fonts/font_8x16.c index 00a0c67a5c7d..34292cdfaa23 100644 --- a/lib/fonts/font_8x16.c +++ b/lib/fonts/font_8x16.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /**********************************************/ /* */ /* Font file generated by cpi2fnt */ diff --git a/lib/fonts/font_8x8.c b/lib/fonts/font_8x8.c index 9f56efe2cee7..751becf3c521 100644 --- a/lib/fonts/font_8x8.c +++ b/lib/fonts/font_8x8.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /**********************************************/ /* */ /* Font file generated by cpi2fnt */ diff --git a/lib/fonts/font_acorn_8x8.c b/lib/fonts/font_acorn_8x8.c index 639e31ae1100..0ff0e85d4481 100644 --- a/lib/fonts/font_acorn_8x8.c +++ b/lib/fonts/font_acorn_8x8.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* Acorn-like font definition, with PC graphics characters */ #include diff --git a/lib/fonts/font_pearl_8x8.c b/lib/fonts/font_pearl_8x8.c index dc6ad539ca4e..b0514c0a7445 100644 --- a/lib/fonts/font_pearl_8x8.c +++ b/lib/fonts/font_pearl_8x8.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /**********************************************/ /* */ /* Font file generated by cpi2fnt */ diff --git a/lib/fonts/font_sun12x22.c b/lib/fonts/font_sun12x22.c index d3643853c33a..955d6eee3959 100644 --- a/lib/fonts/font_sun12x22.c +++ b/lib/fonts/font_sun12x22.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #define FONTDATAMAX 11264 diff --git a/lib/fonts/font_sun8x16.c b/lib/fonts/font_sun8x16.c index 268151325b83..03d71e53954a 100644 --- a/lib/fonts/font_sun8x16.c +++ b/lib/fonts/font_sun8x16.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #define FONTDATAMAX 4096 diff --git a/lib/gen_crc32table.c b/lib/gen_crc32table.c index d83a372fa76f..8f26660ea10a 100644 --- a/lib/gen_crc32table.c +++ b/lib/gen_crc32table.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include "../include/generated/autoconf.h" #include "crc32defs.h" diff --git a/lib/hweight.c b/lib/hweight.c index 43273a7d83cf..7660d88fd496 100644 --- a/lib/hweight.c +++ b/lib/hweight.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/inflate.c b/lib/inflate.c index 013a76193481..fbaf03c1748d 100644 --- a/lib/inflate.c +++ b/lib/inflate.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #define DEBG(x) #define DEBG1(x) /* inflate.c -- Not copyrighted 1992 by Mark Adler diff --git a/lib/int_sqrt.c b/lib/int_sqrt.c index 1ef4cc344977..db0b5aa071fc 100644 --- a/lib/int_sqrt.c +++ b/lib/int_sqrt.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2013 Davidlohr Bueso * diff --git a/lib/iomap.c b/lib/iomap.c index fc3dcb4b238e..541d926da95e 100644 --- a/lib/iomap.c +++ b/lib/iomap.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Implement the default iomap interfaces * diff --git a/lib/iommu-common.c b/lib/iommu-common.c index 858dc1aae478..55b00de106b5 100644 --- a/lib/iommu-common.c +++ b/lib/iommu-common.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * IOMMU mmap management and range allocation functions. * Based almost entirely upon the powerpc iommu allocator. diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c index a816f3a80625..23633c0fda4a 100644 --- a/lib/iommu-helper.c +++ b/lib/iommu-helper.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * IOMMU helper functions for the free area management */ diff --git a/lib/ioremap.c b/lib/ioremap.c index 4bb30206b942..ac7802b0a117 100644 --- a/lib/ioremap.c +++ b/lib/ioremap.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Re-map IO memory to kernel address space so that we can access it. * This is needed for high PCI addresses that aren't mapped in the diff --git a/lib/irq_poll.c b/lib/irq_poll.c index 1d6565e81030..86a709954f5a 100644 --- a/lib/irq_poll.c +++ b/lib/irq_poll.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Functions related to interrupt-poll handling in the block layer. This * is similar to NAPI for network devices. diff --git a/lib/kasprintf.c b/lib/kasprintf.c index 7f6c506a4942..bacf7b83ccf0 100644 --- a/lib/kasprintf.c +++ b/lib/kasprintf.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/lib/kasprintf.c * diff --git a/lib/kstrtox.c b/lib/kstrtox.c index 720144075c1e..661a1e807bd1 100644 --- a/lib/kstrtox.c +++ b/lib/kstrtox.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Convert integer string representation to an integer. * If an integer doesn't fit into specified type, -E is returned. diff --git a/lib/kstrtox.h b/lib/kstrtox.h index f13eeeaf441d..3b4637bcd254 100644 --- a/lib/kstrtox.h +++ b/lib/kstrtox.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LIB_KSTRTOX_H #define _LIB_KSTRTOX_H diff --git a/lib/list_sort.c b/lib/list_sort.c index 9e9acc37652f..85759928215b 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/locking-selftest-hardirq.h b/lib/locking-selftest-hardirq.h index 10d4a150b259..0d144a6d6a96 100644 --- a/lib/locking-selftest-hardirq.h +++ b/lib/locking-selftest-hardirq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #undef IRQ_DISABLE #undef IRQ_ENABLE #undef IRQ_ENTER diff --git a/lib/locking-selftest-mutex.h b/lib/locking-selftest-mutex.h index 68601b6f584b..7526c7746fb2 100644 --- a/lib/locking-selftest-mutex.h +++ b/lib/locking-selftest-mutex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #undef LOCK #define LOCK ML diff --git a/lib/locking-selftest-rlock.h b/lib/locking-selftest-rlock.h index 6789044f4d0e..eccab18f5584 100644 --- a/lib/locking-selftest-rlock.h +++ b/lib/locking-selftest-rlock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #undef LOCK #define LOCK RL diff --git a/lib/locking-selftest-rsem.h b/lib/locking-selftest-rsem.h index 62da886680c7..4544858f922e 100644 --- a/lib/locking-selftest-rsem.h +++ b/lib/locking-selftest-rsem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #undef LOCK #define LOCK RSL diff --git a/lib/locking-selftest-rtmutex.h b/lib/locking-selftest-rtmutex.h index e3cb83989d16..fce8714c4170 100644 --- a/lib/locking-selftest-rtmutex.h +++ b/lib/locking-selftest-rtmutex.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #undef LOCK #define LOCK RTL diff --git a/lib/locking-selftest-softirq.h b/lib/locking-selftest-softirq.h index a83de2a04ace..6adde4867cb8 100644 --- a/lib/locking-selftest-softirq.h +++ b/lib/locking-selftest-softirq.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #undef IRQ_DISABLE #undef IRQ_ENABLE #undef IRQ_ENTER diff --git a/lib/locking-selftest-spin.h b/lib/locking-selftest-spin.h index ccd1b4b09757..6b24d699e502 100644 --- a/lib/locking-selftest-spin.h +++ b/lib/locking-selftest-spin.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #undef LOCK #define LOCK L diff --git a/lib/locking-selftest-wlock.h b/lib/locking-selftest-wlock.h index 0815322d99ed..0bc51c8cf3c5 100644 --- a/lib/locking-selftest-wlock.h +++ b/lib/locking-selftest-wlock.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #undef LOCK #define LOCK WL diff --git a/lib/locking-selftest-wsem.h b/lib/locking-selftest-wsem.h index b88c5f2dc5f0..5ef18f931c9b 100644 --- a/lib/locking-selftest-wsem.h +++ b/lib/locking-selftest-wsem.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #undef LOCK #define LOCK WSL diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c index 2b827b8a1d8c..b5c1293ce147 100644 --- a/lib/locking-selftest.c +++ b/lib/locking-selftest.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * lib/locking-selftest.c * diff --git a/lib/lockref.c b/lib/lockref.c index c4bfcb8836cd..47169ed7e964 100644 --- a/lib/lockref.c +++ b/lib/lockref.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include diff --git a/lib/lzo/lzodefs.h b/lib/lzo/lzodefs.h index 6710b83ce72e..4edefd2f540c 100644 --- a/lib/lzo/lzodefs.h +++ b/lib/lzo/lzodefs.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * lzodefs.h -- architecture, OS and compiler specific defines * diff --git a/lib/memweight.c b/lib/memweight.c index e35fc8771893..94dd72ccaa7f 100644 --- a/lib/memweight.c +++ b/lib/memweight.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/mpi/Makefile b/lib/mpi/Makefile index 019a68c90144..d5874a7f5ff9 100644 --- a/lib/mpi/Makefile +++ b/lib/mpi/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 # # MPI multiprecision maths library (from gpg) # diff --git a/lib/net_utils.c b/lib/net_utils.c index 148fc6e99ef6..af525353395d 100644 --- a/lib/net_utils.c +++ b/lib/net_utils.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/nlattr.c b/lib/nlattr.c index 927c2f19f119..3d8295c85505 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * NETLINK Netlink attributes * diff --git a/lib/nmi_backtrace.c b/lib/nmi_backtrace.c index 0bc0a3535a8a..46e4c749e4eb 100644 --- a/lib/nmi_backtrace.c +++ b/lib/nmi_backtrace.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * NMI backtrace support * diff --git a/lib/nodemask.c b/lib/nodemask.c index e42a5bf44d33..3aa454c54c0d 100644 --- a/lib/nodemask.c +++ b/lib/nodemask.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/notifier-error-inject.h b/lib/notifier-error-inject.h index 99b3b6fc470b..fafff5f2ac45 100644 --- a/lib/notifier-error-inject.h +++ b/lib/notifier-error-inject.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #include #include #include diff --git a/lib/once.c b/lib/once.c index 05c8604627eb..bfb7420d0de3 100644 --- a/lib/once.c +++ b/lib/once.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index 3bf4a9984f4c..c72577e472f2 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Fast batching percpu counters. */ diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile index a93adf6dcfb2..4add700ddfe3 100644 --- a/lib/raid6/Makefile +++ b/lib/raid6/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_RAID6_PQ) += raid6_pq.o raid6_pq-y += algos.o recov.o tables.o int1.o int2.o int4.o \ diff --git a/lib/raid6/recov_s390xc.c b/lib/raid6/recov_s390xc.c index b042dac826cc..179eec900cea 100644 --- a/lib/raid6/recov_s390xc.c +++ b/lib/raid6/recov_s390xc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * RAID-6 data recovery in dual failure mode based on the XC instruction. * diff --git a/lib/raid6/s390vx.uc b/lib/raid6/s390vx.uc index 7b45191a655f..140fa8bb5c23 100644 --- a/lib/raid6/s390vx.uc +++ b/lib/raid6/s390vx.uc @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * raid6_vx$#.c * diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile index 2c7b60edea04..be1010bdc435 100644 --- a/lib/raid6/test/Makefile +++ b/lib/raid6/test/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 # # This is a simple Makefile to test some of the RAID-6 code # from userspace. diff --git a/lib/random32.c b/lib/random32.c index fa594b1140e6..0a90cb0e0fb6 100644 --- a/lib/random32.c +++ b/lib/random32.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * This is a maximally equidistributed combined Tausworthe generator * based on code from GNU Scientific Library 1.5 (30 Jun 2004) diff --git a/lib/rational.c b/lib/rational.c index f0aa21c2a762..ba7443677c90 100644 --- a/lib/rational.c +++ b/lib/rational.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * rational fractions * diff --git a/lib/reciprocal_div.c b/lib/reciprocal_div.c index 464152410c51..fcb4ce682c6f 100644 --- a/lib/reciprocal_div.c +++ b/lib/reciprocal_div.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/refcount.c b/lib/refcount.c index 5d0582a9480c..0eb48353abe3 100644 --- a/lib/refcount.c +++ b/lib/refcount.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Variant of atomic_t specialized for reference counts. * diff --git a/lib/seq_buf.c b/lib/seq_buf.c index cb18469e1f49..11f2ae0f9099 100644 --- a/lib/seq_buf.c +++ b/lib/seq_buf.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * seq_buf.c * diff --git a/lib/sha1.c b/lib/sha1.c index 5a56dfd7b99d..1d96d2c02b82 100644 --- a/lib/sha1.c +++ b/lib/sha1.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * SHA1 routine optimized to do word accesses rather than byte accesses, * and to avoid unnecessary copies into the context array. diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c index 2fb007be0212..835cc6df2776 100644 --- a/lib/smp_processor_id.c +++ b/lib/smp_processor_id.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * lib/smp_processor_id.c * diff --git a/lib/sort.c b/lib/sort.c index 975c6ef6fec7..d6b7a202b0b6 100644 --- a/lib/sort.c +++ b/lib/sort.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * A fast, small, non-recursive O(nlog n) sort for the Linux kernel * diff --git a/lib/string.c b/lib/string.c index 9921dc202db4..5e8d410a93df 100644 --- a/lib/string.c +++ b/lib/string.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/lib/string.c * diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index 7e35fc450c5b..b53e1b5d80f4 100644 --- a/lib/strncpy_from_user.c +++ b/lib/strncpy_from_user.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c index a5f567747ced..60d0bbda8f5e 100644 --- a/lib/strnlen_user.c +++ b/lib/strnlen_user.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/syscall.c b/lib/syscall.c index 2c6cd1b5c3ea..1a7077f20eae 100644 --- a/lib/syscall.c +++ b/lib/syscall.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include #include diff --git a/lib/ubsan.h b/lib/ubsan.h index b2d18d4a53f5..88f23557edbe 100644 --- a/lib/ubsan.h +++ b/lib/ubsan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _LIB_UBSAN_H #define _LIB_UBSAN_H diff --git a/lib/ucs2_string.c b/lib/ucs2_string.c index ae8d2491133c..d7e06b28de38 100644 --- a/lib/ucs2_string.c +++ b/lib/ucs2_string.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include #include diff --git a/lib/usercopy.c b/lib/usercopy.c index f5d9f08ee032..15e2e6fb060e 100644 --- a/lib/usercopy.c +++ b/lib/usercopy.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include /* out-of-line parts */ diff --git a/lib/win_minmax.c b/lib/win_minmax.c index c8420d404926..6bdc1cd15f76 100644 --- a/lib/win_minmax.c +++ b/lib/win_minmax.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /** * lib/minmax.c: windowed min/max tracker * -- cgit