summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig.debug6
-rw-r--r--lib/alloc_tag.c3
-rw-r--r--lib/btree.c4
-rw-r--r--lib/decompress.c21
-rw-r--r--lib/digsig.c1
-rw-r--r--lib/dump_stack.c2
-rw-r--r--lib/fault-inject-usercopy.c4
-rw-r--r--lib/genalloc.c5
-rw-r--r--lib/ref_tracker.c6
-rw-r--r--lib/sys_info.c3
-rw-r--r--lib/test_firmware.c7
11 files changed, 29 insertions, 33 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index cab4c7b27e54..3034e294d50d 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -1067,12 +1067,6 @@ config PANIC_ON_OOPS
Say N if unsure.
-config PANIC_ON_OOPS_VALUE
- int
- range 0 1
- default 0 if !PANIC_ON_OOPS
- default 1 if PANIC_ON_OOPS
-
config PANIC_TIMEOUT
int "panic timeout"
default 0
diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c
index 3ef702e6b69a..f26456988445 100644
--- a/lib/alloc_tag.c
+++ b/lib/alloc_tag.c
@@ -9,6 +9,7 @@
#include <linux/proc_fs.h>
#include <linux/seq_buf.h>
#include <linux/seq_file.h>
+#include <linux/string_choices.h>
#include <linux/vmalloc.h>
#include <linux/kmemleak.h>
@@ -728,7 +729,7 @@ static int __init setup_early_mem_profiling(char *str)
}
mem_profiling_support = true;
pr_info("Memory allocation profiling is enabled %s compression and is turned %s!\n",
- compressed ? "with" : "without", enable ? "on" : "off");
+ compressed ? "with" : "without", str_on_off(enable));
}
if (enable != mem_alloc_profiling_enabled()) {
diff --git a/lib/btree.c b/lib/btree.c
index bb81d3393ac5..9c80c0c7bba8 100644
--- a/lib/btree.c
+++ b/lib/btree.c
@@ -653,9 +653,9 @@ int btree_merge(struct btree_head *target, struct btree_head *victim,
* walks to remove a single object from the victim.
*/
for (;;) {
- if (!btree_last(victim, geo, key))
+ val = btree_last(victim, geo, key);
+ if (!val)
break;
- val = btree_lookup(victim, geo, key);
err = btree_insert(target, geo, key, val, gfp);
if (err)
return err;
diff --git a/lib/decompress.c b/lib/decompress.c
index ab3fc90ffc64..7785471586c6 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -49,15 +49,15 @@ struct compress_format {
};
static const struct compress_format compressed_formats[] __initconst = {
- { {0x1f, 0x8b}, "gzip", gunzip },
- { {0x1f, 0x9e}, "gzip", gunzip },
- { {0x42, 0x5a}, "bzip2", bunzip2 },
- { {0x5d, 0x00}, "lzma", unlzma },
- { {0xfd, 0x37}, "xz", unxz },
- { {0x89, 0x4c}, "lzo", unlzo },
- { {0x02, 0x21}, "lz4", unlz4 },
- { {0x28, 0xb5}, "zstd", unzstd },
- { {0, 0}, NULL, NULL }
+ { .magic = {0x1f, 0x8b}, .name = "gzip", .decompressor = gunzip },
+ { .magic = {0x1f, 0x9e}, .name = "gzip", .decompressor = gunzip },
+ { .magic = {0x42, 0x5a}, .name = "bzip2", .decompressor = bunzip2 },
+ { .magic = {0x5d, 0x00}, .name = "lzma", .decompressor = unlzma },
+ { .magic = {0xfd, 0x37}, .name = "xz", .decompressor = unxz },
+ { .magic = {0x89, 0x4c}, .name = "lzo", .decompressor = unlzo },
+ { .magic = {0x02, 0x21}, .name = "lz4", .decompressor = unlz4 },
+ { .magic = {0x28, 0xb5}, .name = "zstd", .decompressor = unzstd },
+ { /* sentinel */ }
};
decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
@@ -73,11 +73,10 @@ decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]);
- for (cf = compressed_formats; cf->name; cf++) {
+ for (cf = compressed_formats; cf->name; cf++)
if (!memcmp(inbuf, cf->magic, 2))
break;
- }
if (name)
*name = cf->name;
return cf->decompressor;
diff --git a/lib/digsig.c b/lib/digsig.c
index 04b5e55ed95f..2b36f9cc91e9 100644
--- a/lib/digsig.c
+++ b/lib/digsig.c
@@ -159,7 +159,6 @@ static int digsig_verify_rsa(struct key *key,
len = mlen;
head = len - l;
- memset(out1, 0, head);
memcpy(out1 + head, p, l);
kfree(p);
diff --git a/lib/dump_stack.c b/lib/dump_stack.c
index b3a85fe8b673..f0c78b5b5324 100644
--- a/lib/dump_stack.c
+++ b/lib/dump_stack.c
@@ -102,7 +102,7 @@ static void __dump_stack(const char *log_lvl)
*/
asmlinkage __visible void dump_stack_lvl(const char *log_lvl)
{
- bool in_panic = this_cpu_in_panic();
+ bool in_panic = panic_on_this_cpu();
unsigned long flags;
/*
diff --git a/lib/fault-inject-usercopy.c b/lib/fault-inject-usercopy.c
index 77558b6c29ca..75403ec50f49 100644
--- a/lib/fault-inject-usercopy.c
+++ b/lib/fault-inject-usercopy.c
@@ -22,10 +22,8 @@ static int __init fail_usercopy_debugfs(void)
dir = fault_create_debugfs_attr("fail_usercopy", NULL,
&fail_usercopy.attr);
- if (IS_ERR(dir))
- return PTR_ERR(dir);
- return 0;
+ return PTR_ERR_OR_ZERO(dir);
}
late_initcall(fail_usercopy_debugfs);
diff --git a/lib/genalloc.c b/lib/genalloc.c
index 4fa5635bf81b..841f29783833 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -899,8 +899,11 @@ struct gen_pool *of_gen_pool_get(struct device_node *np,
if (!name)
name = of_node_full_name(np_pool);
}
- if (pdev)
+ if (pdev) {
pool = gen_pool_get(&pdev->dev, name);
+ put_device(&pdev->dev);
+ }
+
of_node_put(np_pool);
return pool;
diff --git a/lib/ref_tracker.c b/lib/ref_tracker.c
index cce12287708e..258fb0e7abdf 100644
--- a/lib/ref_tracker.c
+++ b/lib/ref_tracker.c
@@ -75,7 +75,7 @@ ref_tracker_get_stats(struct ref_tracker_dir *dir, unsigned int limit)
struct ref_tracker *tracker;
stats = kmalloc(struct_size(stats, stacks, limit),
- GFP_NOWAIT | __GFP_NOWARN);
+ GFP_NOWAIT);
if (!stats)
return ERR_PTR(-ENOMEM);
stats->total = 0;
@@ -159,7 +159,7 @@ __ref_tracker_dir_pr_ostream(struct ref_tracker_dir *dir,
return;
}
- sbuf = kmalloc(STACK_BUF_SIZE, GFP_NOWAIT | __GFP_NOWARN);
+ sbuf = kmalloc(STACK_BUF_SIZE, GFP_NOWAIT);
for (i = 0, skipped = stats->total; i < stats->count; ++i) {
stack = stats->stacks[i].stack_handle;
@@ -306,7 +306,7 @@ int ref_tracker_free(struct ref_tracker_dir *dir,
}
nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 1);
stack_handle = stack_depot_save(entries, nr_entries,
- GFP_NOWAIT | __GFP_NOWARN);
+ GFP_NOWAIT);
spin_lock_irqsave(&dir->lock, flags);
if (tracker->dead) {
diff --git a/lib/sys_info.c b/lib/sys_info.c
index 5bf503fd7ec1..496f9151c9b6 100644
--- a/lib/sys_info.c
+++ b/lib/sys_info.c
@@ -55,7 +55,7 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
void *buffer, size_t *lenp,
loff_t *ppos)
{
- char names[sizeof(sys_info_avail) + 1];
+ char names[sizeof(sys_info_avail)];
struct ctl_table table;
unsigned long *si_bits_global;
@@ -81,6 +81,7 @@ int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
char *delim = "";
int i, len = 0;
+ names[0] = '\0';
for (i = 0; i < ARRAY_SIZE(si_names); i++) {
if (*si_bits_global & si_names[i].bit) {
len += scnprintf(names + len, sizeof(names) - len,
diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index 211222e63328..be4f93124901 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -26,6 +26,7 @@
#include <linux/kthread.h>
#include <linux/vmalloc.h>
#include <linux/efi_embedded_fw.h>
+#include <linux/string_choices.h>
MODULE_IMPORT_NS("TEST_FIRMWARE");
@@ -304,17 +305,17 @@ static ssize_t config_show(struct device *dev,
"FW_ACTION_NOUEVENT");
len += scnprintf(buf + len, PAGE_SIZE - len,
"into_buf:\t\t%s\n",
- test_fw_config->into_buf ? "true" : "false");
+ str_true_false(test_fw_config->into_buf));
len += scnprintf(buf + len, PAGE_SIZE - len,
"buf_size:\t%zu\n", test_fw_config->buf_size);
len += scnprintf(buf + len, PAGE_SIZE - len,
"file_offset:\t%zu\n", test_fw_config->file_offset);
len += scnprintf(buf + len, PAGE_SIZE - len,
"partial:\t\t%s\n",
- test_fw_config->partial ? "true" : "false");
+ str_true_false(test_fw_config->partial));
len += scnprintf(buf + len, PAGE_SIZE - len,
"sync_direct:\t\t%s\n",
- test_fw_config->sync_direct ? "true" : "false");
+ str_true_false(test_fw_config->sync_direct));
len += scnprintf(buf + len, PAGE_SIZE - len,
"read_fw_idx:\t%u\n", test_fw_config->read_fw_idx);
if (test_fw_config->upload_name)