aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bsearch.c5
-rw-r--r--lib/btree.c4
-rw-r--r--lib/digsig.c5
-rw-r--r--lib/earlycpio.c10
-rw-r--r--lib/find_bit_benchmark.c10
-rw-r--r--lib/genalloc.c51
-rw-r--r--lib/llist.c14
-rw-r--r--lib/lockref.c3
-rw-r--r--lib/raid6/recov_avx2.c6
-rw-r--r--lib/raid6/recov_avx512.c7
-rw-r--r--lib/raid6/recov_neon.c6
-rw-r--r--lib/raid6/recov_neon_inner.c6
-rw-r--r--lib/raid6/recov_ssse3.c6
-rw-r--r--lib/ratelimit.c3
-rw-r--r--lib/sbitmap.c13
-rw-r--r--lib/show_mem.c2
-rw-r--r--lib/test_bpf.c10
-rw-r--r--lib/test_firmware.c14
-rw-r--r--lib/test_static_key_base.c10
-rw-r--r--lib/test_static_keys.c10
-rw-r--r--lib/test_user_copy.c10
21 files changed, 53 insertions, 152 deletions
diff --git a/lib/bsearch.c b/lib/bsearch.c
index 82512fe7b33c..8baa83968162 100644
--- a/lib/bsearch.c
+++ b/lib/bsearch.c
@@ -1,12 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * A generic implementation of binary search for the Linux kernel 3 * A generic implementation of binary search for the Linux kernel
3 * 4 *
4 * Copyright (C) 2008-2009 Ksplice, Inc. 5 * Copyright (C) 2008-2009 Ksplice, Inc.
5 * Author: Tim Abbott <tabbott@ksplice.com> 6 * Author: Tim Abbott <tabbott@ksplice.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; version 2.
10 */ 7 */
11 8
12#include <linux/export.h> 9#include <linux/export.h>
diff --git a/lib/btree.c b/lib/btree.c
index 590facba2c50..b4cf08a5c267 100644
--- a/lib/btree.c
+++ b/lib/btree.c
@@ -1,12 +1,10 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * lib/btree.c - Simple In-memory B+Tree 3 * lib/btree.c - Simple In-memory B+Tree
3 * 4 *
4 * As should be obvious for Linux kernel code, license is GPLv2
5 *
6 * Copyright (c) 2007-2008 Joern Engel <joern@purestorage.com> 5 * Copyright (c) 2007-2008 Joern Engel <joern@purestorage.com>
7 * Bits and pieces stolen from Peter Zijlstra's code, which is 6 * Bits and pieces stolen from Peter Zijlstra's code, which is
8 * Copyright 2007, Red Hat Inc. Peter Zijlstra 7 * Copyright 2007, Red Hat Inc. Peter Zijlstra
9 * GPLv2
10 * 8 *
11 * see http://programming.kicks-ass.net/kernel-patches/vma_lookup/btree.patch 9 * see http://programming.kicks-ass.net/kernel-patches/vma_lookup/btree.patch
12 * 10 *
diff --git a/lib/digsig.c b/lib/digsig.c
index 3b0a579bdcdf..3cf89c775ab2 100644
--- a/lib/digsig.c
+++ b/lib/digsig.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Copyright (C) 2011 Nokia Corporation 3 * Copyright (C) 2011 Nokia Corporation
3 * Copyright (C) 2011 Intel Corporation 4 * Copyright (C) 2011 Intel Corporation
@@ -6,10 +7,6 @@
6 * Dmitry Kasatkin <dmitry.kasatkin@nokia.com> 7 * Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
7 * <dmitry.kasatkin@intel.com> 8 * <dmitry.kasatkin@intel.com>
8 * 9 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, version 2 of the License.
12 *
13 * File: sign.c 10 * File: sign.c
14 * implements signature (RSA) verification 11 * implements signature (RSA) verification
15 * pkcs decoding is based on LibTomCrypt code 12 * pkcs decoding is based on LibTomCrypt code
diff --git a/lib/earlycpio.c b/lib/earlycpio.c
index db283ba4d2c1..c001e084829e 100644
--- a/lib/earlycpio.c
+++ b/lib/earlycpio.c
@@ -1,16 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* ----------------------------------------------------------------------- * 2/* ----------------------------------------------------------------------- *
2 * 3 *
3 * Copyright 2012 Intel Corporation; author H. Peter Anvin 4 * Copyright 2012 Intel Corporation; author H. Peter Anvin
4 * 5 *
5 * This file is part of the Linux kernel, and is made available
6 * under the terms of the GNU General Public License version 2, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * ----------------------------------------------------------------------- */ 6 * ----------------------------------------------------------------------- */
15 7
16/* 8/*
diff --git a/lib/find_bit_benchmark.c b/lib/find_bit_benchmark.c
index f0e394dd2beb..5637c5711db9 100644
--- a/lib/find_bit_benchmark.c
+++ b/lib/find_bit_benchmark.c
@@ -1,16 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Test for find_*_bit functions. 3 * Test for find_*_bit functions.
3 * 4 *
4 * Copyright (c) 2017 Cavium. 5 * Copyright (c) 2017 Cavium.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */ 6 */
15 7
16/* 8/*
diff --git a/lib/genalloc.c b/lib/genalloc.c
index 7e85d1e37a6e..770c769d7cb7 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -168,20 +168,21 @@ struct gen_pool *gen_pool_create(int min_alloc_order, int nid)
168EXPORT_SYMBOL(gen_pool_create); 168EXPORT_SYMBOL(gen_pool_create);
169 169
170/** 170/**
171 * gen_pool_add_virt - add a new chunk of special memory to the pool 171 * gen_pool_add_owner- add a new chunk of special memory to the pool
172 * @pool: pool to add new memory chunk to 172 * @pool: pool to add new memory chunk to
173 * @virt: virtual starting address of memory chunk to add to pool 173 * @virt: virtual starting address of memory chunk to add to pool
174 * @phys: physical starting address of memory chunk to add to pool 174 * @phys: physical starting address of memory chunk to add to pool
175 * @size: size in bytes of the memory chunk to add to pool 175 * @size: size in bytes of the memory chunk to add to pool
176 * @nid: node id of the node the chunk structure and bitmap should be 176 * @nid: node id of the node the chunk structure and bitmap should be
177 * allocated on, or -1 177 * allocated on, or -1
178 * @owner: private data the publisher would like to recall at alloc time
178 * 179 *
179 * Add a new chunk of special memory to the specified pool. 180 * Add a new chunk of special memory to the specified pool.
180 * 181 *
181 * Returns 0 on success or a -ve errno on failure. 182 * Returns 0 on success or a -ve errno on failure.
182 */ 183 */
183int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phys, 184int gen_pool_add_owner(struct gen_pool *pool, unsigned long virt, phys_addr_t phys,
184 size_t size, int nid) 185 size_t size, int nid, void *owner)
185{ 186{
186 struct gen_pool_chunk *chunk; 187 struct gen_pool_chunk *chunk;
187 int nbits = size >> pool->min_alloc_order; 188 int nbits = size >> pool->min_alloc_order;
@@ -195,6 +196,7 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phy
195 chunk->phys_addr = phys; 196 chunk->phys_addr = phys;
196 chunk->start_addr = virt; 197 chunk->start_addr = virt;
197 chunk->end_addr = virt + size - 1; 198 chunk->end_addr = virt + size - 1;
199 chunk->owner = owner;
198 atomic_long_set(&chunk->avail, size); 200 atomic_long_set(&chunk->avail, size);
199 201
200 spin_lock(&pool->lock); 202 spin_lock(&pool->lock);
@@ -203,7 +205,7 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phy
203 205
204 return 0; 206 return 0;
205} 207}
206EXPORT_SYMBOL(gen_pool_add_virt); 208EXPORT_SYMBOL(gen_pool_add_owner);
207 209
208/** 210/**
209 * gen_pool_virt_to_phys - return the physical address of memory 211 * gen_pool_virt_to_phys - return the physical address of memory
@@ -260,35 +262,20 @@ void gen_pool_destroy(struct gen_pool *pool)
260EXPORT_SYMBOL(gen_pool_destroy); 262EXPORT_SYMBOL(gen_pool_destroy);
261 263
262/** 264/**
263 * gen_pool_alloc - allocate special memory from the pool 265 * gen_pool_alloc_algo_owner - allocate special memory from the pool
264 * @pool: pool to allocate from
265 * @size: number of bytes to allocate from the pool
266 *
267 * Allocate the requested number of bytes from the specified pool.
268 * Uses the pool allocation function (with first-fit algorithm by default).
269 * Can not be used in NMI handler on architectures without
270 * NMI-safe cmpxchg implementation.
271 */
272unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
273{
274 return gen_pool_alloc_algo(pool, size, pool->algo, pool->data);
275}
276EXPORT_SYMBOL(gen_pool_alloc);
277
278/**
279 * gen_pool_alloc_algo - allocate special memory from the pool
280 * @pool: pool to allocate from 266 * @pool: pool to allocate from
281 * @size: number of bytes to allocate from the pool 267 * @size: number of bytes to allocate from the pool
282 * @algo: algorithm passed from caller 268 * @algo: algorithm passed from caller
283 * @data: data passed to algorithm 269 * @data: data passed to algorithm
270 * @owner: optionally retrieve the chunk owner
284 * 271 *
285 * Allocate the requested number of bytes from the specified pool. 272 * Allocate the requested number of bytes from the specified pool.
286 * Uses the pool allocation function (with first-fit algorithm by default). 273 * Uses the pool allocation function (with first-fit algorithm by default).
287 * Can not be used in NMI handler on architectures without 274 * Can not be used in NMI handler on architectures without
288 * NMI-safe cmpxchg implementation. 275 * NMI-safe cmpxchg implementation.
289 */ 276 */
290unsigned long gen_pool_alloc_algo(struct gen_pool *pool, size_t size, 277unsigned long gen_pool_alloc_algo_owner(struct gen_pool *pool, size_t size,
291 genpool_algo_t algo, void *data) 278 genpool_algo_t algo, void *data, void **owner)
292{ 279{
293 struct gen_pool_chunk *chunk; 280 struct gen_pool_chunk *chunk;
294 unsigned long addr = 0; 281 unsigned long addr = 0;
@@ -299,6 +286,9 @@ unsigned long gen_pool_alloc_algo(struct gen_pool *pool, size_t size,
299 BUG_ON(in_nmi()); 286 BUG_ON(in_nmi());
300#endif 287#endif
301 288
289 if (owner)
290 *owner = NULL;
291
302 if (size == 0) 292 if (size == 0)
303 return 0; 293 return 0;
304 294
@@ -326,12 +316,14 @@ retry:
326 addr = chunk->start_addr + ((unsigned long)start_bit << order); 316 addr = chunk->start_addr + ((unsigned long)start_bit << order);
327 size = nbits << order; 317 size = nbits << order;
328 atomic_long_sub(size, &chunk->avail); 318 atomic_long_sub(size, &chunk->avail);
319 if (owner)
320 *owner = chunk->owner;
329 break; 321 break;
330 } 322 }
331 rcu_read_unlock(); 323 rcu_read_unlock();
332 return addr; 324 return addr;
333} 325}
334EXPORT_SYMBOL(gen_pool_alloc_algo); 326EXPORT_SYMBOL(gen_pool_alloc_algo_owner);
335 327
336/** 328/**
337 * gen_pool_dma_alloc - allocate special memory from the pool for DMA usage 329 * gen_pool_dma_alloc - allocate special memory from the pool for DMA usage
@@ -367,12 +359,14 @@ EXPORT_SYMBOL(gen_pool_dma_alloc);
367 * @pool: pool to free to 359 * @pool: pool to free to
368 * @addr: starting address of memory to free back to pool 360 * @addr: starting address of memory to free back to pool
369 * @size: size in bytes of memory to free 361 * @size: size in bytes of memory to free
362 * @owner: private data stashed at gen_pool_add() time
370 * 363 *
371 * Free previously allocated special memory back to the specified 364 * Free previously allocated special memory back to the specified
372 * pool. Can not be used in NMI handler on architectures without 365 * pool. Can not be used in NMI handler on architectures without
373 * NMI-safe cmpxchg implementation. 366 * NMI-safe cmpxchg implementation.
374 */ 367 */
375void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size) 368void gen_pool_free_owner(struct gen_pool *pool, unsigned long addr, size_t size,
369 void **owner)
376{ 370{
377 struct gen_pool_chunk *chunk; 371 struct gen_pool_chunk *chunk;
378 int order = pool->min_alloc_order; 372 int order = pool->min_alloc_order;
@@ -382,6 +376,9 @@ void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size)
382 BUG_ON(in_nmi()); 376 BUG_ON(in_nmi());
383#endif 377#endif
384 378
379 if (owner)
380 *owner = NULL;
381
385 nbits = (size + (1UL << order) - 1) >> order; 382 nbits = (size + (1UL << order) - 1) >> order;
386 rcu_read_lock(); 383 rcu_read_lock();
387 list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) { 384 list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) {
@@ -392,6 +389,8 @@ void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size)
392 BUG_ON(remain); 389 BUG_ON(remain);
393 size = nbits << order; 390 size = nbits << order;
394 atomic_long_add(size, &chunk->avail); 391 atomic_long_add(size, &chunk->avail);
392 if (owner)
393 *owner = chunk->owner;
395 rcu_read_unlock(); 394 rcu_read_unlock();
396 return; 395 return;
397 } 396 }
@@ -399,7 +398,7 @@ void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size)
399 rcu_read_unlock(); 398 rcu_read_unlock();
400 BUG(); 399 BUG();
401} 400}
402EXPORT_SYMBOL(gen_pool_free); 401EXPORT_SYMBOL(gen_pool_free_owner);
403 402
404/** 403/**
405 * gen_pool_for_each_chunk - call func for every chunk of generic memory pool 404 * gen_pool_for_each_chunk - call func for every chunk of generic memory pool
diff --git a/lib/llist.c b/lib/llist.c
index 7062e931a7bb..611ce4881a87 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Lock-less NULL terminated single linked list 3 * Lock-less NULL terminated single linked list
3 * 4 *
@@ -8,19 +9,6 @@
8 * 9 *
9 * Copyright 2010,2011 Intel Corp. 10 * Copyright 2010,2011 Intel Corp.
10 * Author: Huang Ying <ying.huang@intel.com> 11 * Author: Huang Ying <ying.huang@intel.com>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License version
14 * 2 as published by the Free Software Foundation;
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */ 12 */
25#include <linux/kernel.h> 13#include <linux/kernel.h>
26#include <linux/export.h> 14#include <linux/export.h>
diff --git a/lib/lockref.c b/lib/lockref.c
index 3d468b53d4c9..5b34bbd3eba8 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -9,6 +9,7 @@
9 * failure case. 9 * failure case.
10 */ 10 */
11#define CMPXCHG_LOOP(CODE, SUCCESS) do { \ 11#define CMPXCHG_LOOP(CODE, SUCCESS) do { \
12 int retry = 100; \
12 struct lockref old; \ 13 struct lockref old; \
13 BUILD_BUG_ON(sizeof(old) != 8); \ 14 BUILD_BUG_ON(sizeof(old) != 8); \
14 old.lock_count = READ_ONCE(lockref->lock_count); \ 15 old.lock_count = READ_ONCE(lockref->lock_count); \
@@ -21,6 +22,8 @@
21 if (likely(old.lock_count == prev.lock_count)) { \ 22 if (likely(old.lock_count == prev.lock_count)) { \
22 SUCCESS; \ 23 SUCCESS; \
23 } \ 24 } \
25 if (!--retry) \
26 break; \
24 cpu_relax(); \ 27 cpu_relax(); \
25 } \ 28 } \
26} while (0) 29} while (0)
diff --git a/lib/raid6/recov_avx2.c b/lib/raid6/recov_avx2.c
index 53fe3d7bdfb3..7a3b5e7f66ee 100644
--- a/lib/raid6/recov_avx2.c
+++ b/lib/raid6/recov_avx2.c
@@ -1,11 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Copyright (C) 2012 Intel Corporation 3 * Copyright (C) 2012 Intel Corporation
3 * Author: Jim Kukunas <james.t.kukunas@linux.intel.com> 4 * Author: Jim Kukunas <james.t.kukunas@linux.intel.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; version 2
8 * of the License.
9 */ 5 */
10 6
11#ifdef CONFIG_AS_AVX2 7#ifdef CONFIG_AS_AVX2
diff --git a/lib/raid6/recov_avx512.c b/lib/raid6/recov_avx512.c
index 625aafa33b61..fd9e15bf3f30 100644
--- a/lib/raid6/recov_avx512.c
+++ b/lib/raid6/recov_avx512.c
@@ -1,14 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Copyright (C) 2016 Intel Corporation 3 * Copyright (C) 2016 Intel Corporation
3 * 4 *
4 * Author: Gayatri Kammela <gayatri.kammela@intel.com> 5 * Author: Gayatri Kammela <gayatri.kammela@intel.com>
5 * Author: Megha Dey <megha.dey@linux.intel.com> 6 * Author: Megha Dey <megha.dey@linux.intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 *
12 */ 7 */
13 8
14#ifdef CONFIG_AS_AVX512 9#ifdef CONFIG_AS_AVX512
diff --git a/lib/raid6/recov_neon.c b/lib/raid6/recov_neon.c
index eeb5c4065b92..d6fba8bf8c0a 100644
--- a/lib/raid6/recov_neon.c
+++ b/lib/raid6/recov_neon.c
@@ -1,11 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Copyright (C) 2012 Intel Corporation 3 * Copyright (C) 2012 Intel Corporation
3 * Copyright (C) 2017 Linaro Ltd. <ard.biesheuvel@linaro.org> 4 * Copyright (C) 2017 Linaro Ltd. <ard.biesheuvel@linaro.org>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; version 2
8 * of the License.
9 */ 5 */
10 6
11#include <linux/raid/pq.h> 7#include <linux/raid/pq.h>
diff --git a/lib/raid6/recov_neon_inner.c b/lib/raid6/recov_neon_inner.c
index f13c07f82297..90eb80d43790 100644
--- a/lib/raid6/recov_neon_inner.c
+++ b/lib/raid6/recov_neon_inner.c
@@ -1,11 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Copyright (C) 2012 Intel Corporation 3 * Copyright (C) 2012 Intel Corporation
3 * Copyright (C) 2017 Linaro Ltd. <ard.biesheuvel@linaro.org> 4 * Copyright (C) 2017 Linaro Ltd. <ard.biesheuvel@linaro.org>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; version 2
8 * of the License.
9 */ 5 */
10 6
11#include <arm_neon.h> 7#include <arm_neon.h>
diff --git a/lib/raid6/recov_ssse3.c b/lib/raid6/recov_ssse3.c
index cda33e56a5e3..1de97d2405d0 100644
--- a/lib/raid6/recov_ssse3.c
+++ b/lib/raid6/recov_ssse3.c
@@ -1,10 +1,6 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Copyright (C) 2012 Intel Corporation 3 * Copyright (C) 2012 Intel Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; version 2
7 * of the License.
8 */ 4 */
9 5
10#ifdef CONFIG_AS_SSSE3 6#ifdef CONFIG_AS_SSSE3
diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index d01f47135239..e01a93f46f83 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * ratelimit.c - Do something with rate limit. 3 * ratelimit.c - Do something with rate limit.
3 * 4 *
@@ -5,8 +6,6 @@
5 * 6 *
6 * 2008-05-01 rewrite the function and use a ratelimit_state data struct as 7 * 2008-05-01 rewrite the function and use a ratelimit_state data struct as
7 * parameter. Now every user can use their own standalone ratelimit_state. 8 * parameter. Now every user can use their own standalone ratelimit_state.
8 *
9 * This file is released under the GPLv2.
10 */ 9 */
11 10
12#include <linux/ratelimit.h> 11#include <linux/ratelimit.h>
diff --git a/lib/sbitmap.c b/lib/sbitmap.c
index 4a7fc4915dfc..54f57cd117c6 100644
--- a/lib/sbitmap.c
+++ b/lib/sbitmap.c
@@ -1,18 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Copyright (C) 2016 Facebook 3 * Copyright (C) 2016 Facebook
3 * Copyright (C) 2013-2014 Jens Axboe 4 * Copyright (C) 2013-2014 Jens Axboe
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public
7 * License v2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */ 5 */
17 6
18#include <linux/sched.h> 7#include <linux/sched.h>
diff --git a/lib/show_mem.c b/lib/show_mem.c
index 6a042f53e7bb..5c86ef4c899f 100644
--- a/lib/show_mem.c
+++ b/lib/show_mem.c
@@ -1,8 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Generic show_mem() implementation 3 * Generic show_mem() implementation
3 * 4 *
4 * Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de> 5 * Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de>
5 * All code subject to the GPL version 2.
6 */ 6 */
7 7
8#include <linux/mm.h> 8#include <linux/mm.h>
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 0845f635f404..c41705835cba 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -1,16 +1,8 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Testsuite for BPF interpreter and BPF JIT compiler 3 * Testsuite for BPF interpreter and BPF JIT compiler
3 * 4 *
4 * Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com 5 * Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */ 6 */
15 7
16#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index 787c146eb485..83ea6c4e623c 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -224,30 +224,30 @@ static ssize_t config_show(struct device *dev,
224 224
225 mutex_lock(&test_fw_mutex); 225 mutex_lock(&test_fw_mutex);
226 226
227 len += snprintf(buf, PAGE_SIZE, 227 len += scnprintf(buf, PAGE_SIZE - len,
228 "Custom trigger configuration for: %s\n", 228 "Custom trigger configuration for: %s\n",
229 dev_name(dev)); 229 dev_name(dev));
230 230
231 if (test_fw_config->name) 231 if (test_fw_config->name)
232 len += snprintf(buf+len, PAGE_SIZE, 232 len += scnprintf(buf+len, PAGE_SIZE - len,
233 "name:\t%s\n", 233 "name:\t%s\n",
234 test_fw_config->name); 234 test_fw_config->name);
235 else 235 else
236 len += snprintf(buf+len, PAGE_SIZE, 236 len += scnprintf(buf+len, PAGE_SIZE - len,
237 "name:\tEMTPY\n"); 237 "name:\tEMTPY\n");
238 238
239 len += snprintf(buf+len, PAGE_SIZE, 239 len += scnprintf(buf+len, PAGE_SIZE - len,
240 "num_requests:\t%u\n", test_fw_config->num_requests); 240 "num_requests:\t%u\n", test_fw_config->num_requests);
241 241
242 len += snprintf(buf+len, PAGE_SIZE, 242 len += scnprintf(buf+len, PAGE_SIZE - len,
243 "send_uevent:\t\t%s\n", 243 "send_uevent:\t\t%s\n",
244 test_fw_config->send_uevent ? 244 test_fw_config->send_uevent ?
245 "FW_ACTION_HOTPLUG" : 245 "FW_ACTION_HOTPLUG" :
246 "FW_ACTION_NOHOTPLUG"); 246 "FW_ACTION_NOHOTPLUG");
247 len += snprintf(buf+len, PAGE_SIZE, 247 len += scnprintf(buf+len, PAGE_SIZE - len,
248 "sync_direct:\t\t%s\n", 248 "sync_direct:\t\t%s\n",
249 test_fw_config->sync_direct ? "true" : "false"); 249 test_fw_config->sync_direct ? "true" : "false");
250 len += snprintf(buf+len, PAGE_SIZE, 250 len += scnprintf(buf+len, PAGE_SIZE - len,
251 "read_fw_idx:\t%u\n", test_fw_config->read_fw_idx); 251 "read_fw_idx:\t%u\n", test_fw_config->read_fw_idx);
252 252
253 mutex_unlock(&test_fw_mutex); 253 mutex_unlock(&test_fw_mutex);
diff --git a/lib/test_static_key_base.c b/lib/test_static_key_base.c
index 729447aea02f..5089a2e2bdd8 100644
--- a/lib/test_static_key_base.c
+++ b/lib/test_static_key_base.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Kernel module for testing static keys. 3 * Kernel module for testing static keys.
3 * 4 *
@@ -5,15 +6,6 @@
5 * 6 *
6 * Authors: 7 * Authors:
7 * Jason Baron <jbaron@akamai.com> 8 * Jason Baron <jbaron@akamai.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */ 9 */
18 10
19#include <linux/module.h> 11#include <linux/module.h>
diff --git a/lib/test_static_keys.c b/lib/test_static_keys.c
index 915d75df2086..42daa74be029 100644
--- a/lib/test_static_keys.c
+++ b/lib/test_static_keys.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Kernel module for testing static keys. 3 * Kernel module for testing static keys.
3 * 4 *
@@ -5,15 +6,6 @@
5 * 6 *
6 * Authors: 7 * Authors:
7 * Jason Baron <jbaron@akamai.com> 8 * Jason Baron <jbaron@akamai.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */ 9 */
18 10
19#include <linux/module.h> 11#include <linux/module.h>
diff --git a/lib/test_user_copy.c b/lib/test_user_copy.c
index e161f0498f42..67bcd5dfd847 100644
--- a/lib/test_user_copy.c
+++ b/lib/test_user_copy.c
@@ -1,3 +1,4 @@
1// SPDX-License-Identifier: GPL-2.0-only
1/* 2/*
2 * Kernel module for testing copy_to/from_user infrastructure. 3 * Kernel module for testing copy_to/from_user infrastructure.
3 * 4 *
@@ -5,15 +6,6 @@
5 * 6 *
6 * Authors: 7 * Authors:
7 * Kees Cook <keescook@chromium.org> 8 * Kees Cook <keescook@chromium.org>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */ 9 */
18 10
19#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 11#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt