diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bitmap.c | 4 | ||||
-rw-r--r-- | lib/clz_ctz.c | 4 | ||||
-rw-r--r-- | lib/cmdline.c | 5 | ||||
-rw-r--r-- | lib/cpu_rmap.c | 5 | ||||
-rw-r--r-- | lib/crc-ccitt.c | 4 | ||||
-rw-r--r-- | lib/crc-itu-t.c | 4 | ||||
-rw-r--r-- | lib/crc-t10dif.c | 4 | ||||
-rw-r--r-- | lib/crc16.c | 4 | ||||
-rw-r--r-- | lib/crc4.c | 4 | ||||
-rw-r--r-- | lib/crc7.c | 4 | ||||
-rw-r--r-- | lib/decompress_unlz4.c | 5 | ||||
-rw-r--r-- | lib/genalloc.c | 4 | ||||
-rw-r--r-- | lib/hexdump.c | 6 | ||||
-rw-r--r-- | lib/idr.c | 14 | ||||
-rw-r--r-- | lib/iomap_copy.c | 14 | ||||
-rw-r--r-- | lib/jedec_ddr_data.c | 5 | ||||
-rw-r--r-- | lib/klist.c | 3 | ||||
-rw-r--r-- | lib/parser.c | 4 | ||||
-rw-r--r-- | lib/raid6/neon.c | 5 | ||||
-rw-r--r-- | lib/rhashtable.c | 5 | ||||
-rw-r--r-- | lib/scatterlist.c | 4 | ||||
-rw-r--r-- | lib/sg_split.c | 4 | ||||
-rw-r--r-- | lib/test_kasan.c | 6 | ||||
-rw-r--r-- | lib/test_rhashtable.c | 5 | ||||
-rw-r--r-- | lib/test_stackinit.c | 21 | ||||
-rw-r--r-- | lib/test_xarray.c | 38 | ||||
-rw-r--r-- | lib/ubsan.c | 6 | ||||
-rw-r--r-- | lib/xarray.c | 12 |
28 files changed, 99 insertions, 104 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index f235434df87b..bbe2589e8497 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -1,9 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * lib/bitmap.c * Helper functions for bitmap.h. - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. */ #include <linux/export.h> #include <linux/thread_info.h> diff --git a/lib/clz_ctz.c b/lib/clz_ctz.c index 2e11e48446ab..0d3a686b5ba2 100644 --- a/lib/clz_ctz.c +++ b/lib/clz_ctz.c @@ -1,11 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * lib/clz_ctz.c * * Copyright (C) 2013 Chanho Min <chanho.min@lge.com> * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. * The functions in this file aren't called directly, but are required by * GCC builtins such as __builtin_ctz, and therefore they can't be removed * despite appearing unreferenced in kernel source. diff --git a/lib/cmdline.c b/lib/cmdline.c index dc59d6216318..fbb9981a04a4 100644 --- a/lib/cmdline.c +++ b/lib/cmdline.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * linux/lib/cmdline.c * Helper functions generally used for parsing kernel command line @@ -5,11 +6,7 @@ * * Code and copyrights come from init/main.c and arch/i386/kernel/setup.c. * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. - * * GNU Indent formatting options for this file: -kr -i8 -npsl -pcs - * */ #include <linux/export.h> diff --git a/lib/cpu_rmap.c b/lib/cpu_rmap.c index f610b2a10b3e..075f3788bbe4 100644 --- a/lib/cpu_rmap.c +++ b/lib/cpu_rmap.c @@ -1,10 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * cpu_rmap.c: CPU affinity reverse-map support * Copyright 2011 Solarflare Communications Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation, incorporated herein by reference. */ #include <linux/cpu_rmap.h> diff --git a/lib/crc-ccitt.c b/lib/crc-ccitt.c index d873b34039ff..d1a7d29d2ac9 100644 --- a/lib/crc-ccitt.c +++ b/lib/crc-ccitt.c @@ -1,8 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * linux/lib/crc-ccitt.c - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. */ #include <linux/types.h> diff --git a/lib/crc-itu-t.c b/lib/crc-itu-t.c index b3219d0abfb4..1974b355c148 100644 --- a/lib/crc-itu-t.c +++ b/lib/crc-itu-t.c @@ -1,8 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * crc-itu-t.c - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. */ #include <linux/types.h> diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c index e89ebfdbb0fc..8cc01a603416 100644 --- a/lib/crc-t10dif.c +++ b/lib/crc-t10dif.c @@ -1,11 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * T10 Data Integrity Field CRC16 calculation * * Copyright (c) 2007 Oracle Corporation. All rights reserved. * Written by Martin K. Petersen <martin.petersen@oracle.com> - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. */ #include <linux/types.h> diff --git a/lib/crc16.c b/lib/crc16.c index 8737b084d1f9..5c3a803c01e0 100644 --- a/lib/crc16.c +++ b/lib/crc16.c @@ -1,8 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * crc16.c - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. */ #include <linux/types.h> diff --git a/lib/crc4.c b/lib/crc4.c index 164ed9444cd3..e7e1779c67d9 100644 --- a/lib/crc4.c +++ b/lib/crc4.c @@ -1,8 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * crc4.c - simple crc-4 calculations. - * - * This source code is licensed under the GNU General Public License, Version - * 2. See the file COPYING for more details. */ #include <linux/crc4.h> diff --git a/lib/crc7.c b/lib/crc7.c index bf6255e23919..6a848d73e804 100644 --- a/lib/crc7.c +++ b/lib/crc7.c @@ -1,8 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * crc7.c - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. */ #include <linux/types.h> diff --git a/lib/decompress_unlz4.c b/lib/decompress_unlz4.c index 1b0baf3008ea..c0cfcfd486be 100644 --- a/lib/decompress_unlz4.c +++ b/lib/decompress_unlz4.c @@ -1,11 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Wrapper for decompressing LZ4-compressed kernel, initramfs, and initrd * * Copyright (C) 2013, LG Electronics, Kyungsik Lee <kyungsik.lee@lge.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifdef STATIC diff --git a/lib/genalloc.c b/lib/genalloc.c index 770c769d7cb7..5257f74fccf3 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Basic general purpose allocator for managing special purpose * memory, for example, memory that is not managed by the regular @@ -23,9 +24,6 @@ * CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG. * * Copyright 2005 (C) Jes Sorensen <jes@trained-monkey.org> - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. */ #include <linux/slab.h> diff --git a/lib/hexdump.c b/lib/hexdump.c index 81b70ed37209..b1d55b669ae2 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -1,10 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * lib/hexdump.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. */ #include <linux/types.h> diff --git a/lib/idr.c b/lib/idr.c index c34e256d2f01..66a374892482 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -228,11 +228,21 @@ void *idr_get_next(struct idr *idr, int *nextid) { struct radix_tree_iter iter; void __rcu **slot; + void *entry = NULL; unsigned long base = idr->idr_base; unsigned long id = *nextid; id = (id < base) ? 0 : id - base; - slot = radix_tree_iter_find(&idr->idr_rt, &iter, id); + radix_tree_for_each_slot(slot, &idr->idr_rt, &iter, id) { + entry = rcu_dereference_raw(*slot); + if (!entry) + continue; + if (!xa_is_internal(entry)) + break; + if (slot != &idr->idr_rt.xa_head && !xa_is_retry(entry)) + break; + slot = radix_tree_iter_retry(&iter); + } if (!slot) return NULL; id = iter.index + base; @@ -241,7 +251,7 @@ void *idr_get_next(struct idr *idr, int *nextid) return NULL; *nextid = id; - return rcu_dereference_raw(*slot); + return entry; } EXPORT_SYMBOL(idr_get_next); diff --git a/lib/iomap_copy.c b/lib/iomap_copy.c index b8f1d6cbb200..5de7c04e05ef 100644 --- a/lib/iomap_copy.c +++ b/lib/iomap_copy.c @@ -1,18 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2006 PathScale, Inc. All Rights Reserved. - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <linux/export.h> diff --git a/lib/jedec_ddr_data.c b/lib/jedec_ddr_data.c index 6d2cbf1d567f..d0b312e28d36 100644 --- a/lib/jedec_ddr_data.c +++ b/lib/jedec_ddr_data.c @@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * DDR addressing details and AC timing parameters from JEDEC specs * * Copyright (C) 2012 Texas Instruments, Inc. * * Aneesh V <aneesh@ti.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #include <memory/jedec_ddr.h> diff --git a/lib/klist.c b/lib/klist.c index f6b547812fe3..332a4fbf18ff 100644 --- a/lib/klist.c +++ b/lib/klist.c @@ -1,10 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * klist.c - Routines for manipulating klists. * * Copyright (C) 2005 Patrick Mochel * - * This file is released under the GPL v2. - * * This klist interface provides a couple of structures that wrap around * struct list_head to provide explicit list "head" (struct klist) and list * "node" (struct klist_node) objects. For struct klist, a spinlock is diff --git a/lib/parser.c b/lib/parser.c index dd70e5e6c9e2..f5b3e5d7a7f9 100644 --- a/lib/parser.c +++ b/lib/parser.c @@ -1,8 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * lib/parser.c - simple parser for mount, etc. options. - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. */ #include <linux/ctype.h> diff --git a/lib/raid6/neon.c b/lib/raid6/neon.c index 7076ef1ba3dd..0a2e76035ea9 100644 --- a/lib/raid6/neon.c +++ b/lib/raid6/neon.c @@ -1,11 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * linux/lib/raid6/neon.c - RAID6 syndrome calculation using ARM NEON intrinsics * * Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #include <linux/raid/pq.h> diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 935ec80f213f..bdb7e4cadf05 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Resizable, Scalable, Concurrent Hash Table * @@ -8,10 +9,6 @@ * Code partially derived from nft_hash * Rewritten with rehash code from br_multicast plus single list * pointer as suggested by Josh Triplett - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #include <linux/atomic.h> diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 739dc9fe2c55..2882d9ba6607 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2007 Jens Axboe <jens.axboe@oracle.com> * * Scatterlist handling helpers. - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. */ #include <linux/export.h> #include <linux/slab.h> diff --git a/lib/sg_split.c b/lib/sg_split.c index b063410c3593..9982c63d1063 100644 --- a/lib/sg_split.c +++ b/lib/sg_split.c @@ -1,10 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2015 Robert Jarzmik <robert.jarzmik@free.fr> * * Scatterlist splitting helpers. - * - * This source code is licensed under the GNU General Public License, - * Version 2. See the file COPYING for more details. */ #include <linux/scatterlist.h> diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 7de2702621dc..e3c593c38eff 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -1,12 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * Author: Andrey Ryabinin <a.ryabinin@samsung.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * */ #define pr_fmt(fmt) "kasan test: %s " fmt, __func__ diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c index 084fe5a6ac57..c5a6fef7b45d 100644 --- a/lib/test_rhashtable.c +++ b/lib/test_rhashtable.c @@ -1,12 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Resizable, Scalable, Concurrent Hash Table * * Copyright (c) 2014-2015 Thomas Graf <tgraf@suug.ch> * Copyright (c) 2008-2014 Patrick McHardy <kaber@trash.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ /************************************************************************** diff --git a/lib/test_stackinit.c b/lib/test_stackinit.c index e97dc54b4fdf..2d7d257a430e 100644 --- a/lib/test_stackinit.c +++ b/lib/test_stackinit.c @@ -12,7 +12,7 @@ /* Exfiltration buffer. */ #define MAX_VAR_SIZE 128 -static char check_buf[MAX_VAR_SIZE]; +static u8 check_buf[MAX_VAR_SIZE]; /* Character array to trigger stack protector in all functions. */ #define VAR_BUFFER 32 @@ -106,9 +106,18 @@ static noinline __init int test_ ## name (void) \ \ /* Fill clone type with zero for per-field init. */ \ memset(&zero, 0x00, sizeof(zero)); \ + /* Clear entire check buffer for 0xFF overlap test. */ \ + memset(check_buf, 0x00, sizeof(check_buf)); \ /* Fill stack with 0xFF. */ \ ignored = leaf_ ##name((unsigned long)&ignored, 1, \ FETCH_ARG_ ## which(zero)); \ + /* Verify all bytes overwritten with 0xFF. */ \ + for (sum = 0, i = 0; i < target_size; i++) \ + sum += (check_buf[i] != 0xFF); \ + if (sum) { \ + pr_err(#name ": leaf fill was not 0xFF!?\n"); \ + return 1; \ + } \ /* Clear entire check buffer for later bit tests. */ \ memset(check_buf, 0x00, sizeof(check_buf)); \ /* Extract stack-defined variable contents. */ \ @@ -126,9 +135,9 @@ static noinline __init int test_ ## name (void) \ return 1; \ } \ \ - /* Look for any set bits in the check region. */ \ - for (i = 0; i < sizeof(check_buf); i++) \ - sum += (check_buf[i] != 0); \ + /* Look for any bytes still 0xFF in check region. */ \ + for (sum = 0, i = 0; i < target_size; i++) \ + sum += (check_buf[i] == 0xFF); \ \ if (sum == 0) \ pr_info(#name " ok\n"); \ @@ -162,13 +171,13 @@ static noinline __init int leaf_ ## name(unsigned long sp, \ * Keep this buffer around to make sure we've got a \ * stack frame of SOME kind... \ */ \ - memset(buf, (char)(sp && 0xff), sizeof(buf)); \ + memset(buf, (char)(sp & 0xff), sizeof(buf)); \ /* Fill variable with 0xFF. */ \ if (fill) { \ fill_start = &var; \ fill_size = sizeof(var); \ memset(fill_start, \ - (char)((sp && 0xff) | forced_mask), \ + (char)((sp & 0xff) | forced_mask), \ fill_size); \ } \ \ diff --git a/lib/test_xarray.c b/lib/test_xarray.c index 5d4bad8bd96a..9d631a7b6a70 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c @@ -38,6 +38,12 @@ static void *xa_store_index(struct xarray *xa, unsigned long index, gfp_t gfp) return xa_store(xa, index, xa_mk_index(index), gfp); } +static void xa_insert_index(struct xarray *xa, unsigned long index) +{ + XA_BUG_ON(xa, xa_insert(xa, index, xa_mk_index(index), + GFP_KERNEL) != 0); +} + static void xa_alloc_index(struct xarray *xa, unsigned long index, gfp_t gfp) { u32 id; @@ -338,6 +344,37 @@ static noinline void check_xa_shrink(struct xarray *xa) } } +static noinline void check_insert(struct xarray *xa) +{ + unsigned long i; + + for (i = 0; i < 1024; i++) { + xa_insert_index(xa, i); + XA_BUG_ON(xa, xa_load(xa, i - 1) != NULL); + XA_BUG_ON(xa, xa_load(xa, i + 1) != NULL); + xa_erase_index(xa, i); + } + + for (i = 10; i < BITS_PER_LONG; i++) { + xa_insert_index(xa, 1UL << i); + XA_BUG_ON(xa, xa_load(xa, (1UL << i) - 1) != NULL); + XA_BUG_ON(xa, xa_load(xa, (1UL << i) + 1) != NULL); + xa_erase_index(xa, 1UL << i); + + xa_insert_index(xa, (1UL << i) - 1); + XA_BUG_ON(xa, xa_load(xa, (1UL << i) - 2) != NULL); + XA_BUG_ON(xa, xa_load(xa, 1UL << i) != NULL); + xa_erase_index(xa, (1UL << i) - 1); + } + + xa_insert_index(xa, ~0UL); + XA_BUG_ON(xa, xa_load(xa, 0UL) != NULL); + XA_BUG_ON(xa, xa_load(xa, ~1UL) != NULL); + xa_erase_index(xa, ~0UL); + + XA_BUG_ON(xa, !xa_empty(xa)); +} + static noinline void check_cmpxchg(struct xarray *xa) { void *FIVE = xa_mk_value(5); @@ -1527,6 +1564,7 @@ static int xarray_checks(void) check_xa_mark(&array); check_xa_shrink(&array); check_xas_erase(&array); + check_insert(&array); check_cmpxchg(&array); check_reserve(&array); check_reserve(&xa0); diff --git a/lib/ubsan.c b/lib/ubsan.c index ecc179338094..e7d31735950d 100644 --- a/lib/ubsan.c +++ b/lib/ubsan.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * UBSAN error reporting functions * * Copyright (c) 2014 Samsung Electronics Co., Ltd. * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * */ #include <linux/bitops.h> diff --git a/lib/xarray.c b/lib/xarray.c index 6be3acbb861f..446b956c9188 100644 --- a/lib/xarray.c +++ b/lib/xarray.c @@ -298,6 +298,8 @@ bool xas_nomem(struct xa_state *xas, gfp_t gfp) xas_destroy(xas); return false; } + if (xas->xa->xa_flags & XA_FLAGS_ACCOUNT) + gfp |= __GFP_ACCOUNT; xas->xa_alloc = kmem_cache_alloc(radix_tree_node_cachep, gfp); if (!xas->xa_alloc) return false; @@ -325,6 +327,8 @@ static bool __xas_nomem(struct xa_state *xas, gfp_t gfp) xas_destroy(xas); return false; } + if (xas->xa->xa_flags & XA_FLAGS_ACCOUNT) + gfp |= __GFP_ACCOUNT; if (gfpflags_allow_blocking(gfp)) { xas_unlock_type(xas, lock_type); xas->xa_alloc = kmem_cache_alloc(radix_tree_node_cachep, gfp); @@ -358,8 +362,12 @@ static void *xas_alloc(struct xa_state *xas, unsigned int shift) if (node) { xas->xa_alloc = NULL; } else { - node = kmem_cache_alloc(radix_tree_node_cachep, - GFP_NOWAIT | __GFP_NOWARN); + gfp_t gfp = GFP_NOWAIT | __GFP_NOWARN; + + if (xas->xa->xa_flags & XA_FLAGS_ACCOUNT) + gfp |= __GFP_ACCOUNT; + + node = kmem_cache_alloc(radix_tree_node_cachep, gfp); if (!node) { xas_set_err(xas, -ENOMEM); return NULL; |