summaryrefslogtreecommitdiffstats
path: root/kernel/module
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2023-04-18 01:09:57 +0200
committerLuis Chamberlain <mcgrof@kernel.org>2023-04-18 20:36:24 +0200
commit9f5cab173e19201eebeaca853ff664a9a269fed0 (patch)
tree093f391ee9288063a748750df290390fccf0bc1f /kernel/module
parentmodule: fix building stats for 32-bit targets (diff)
downloadlinux-9f5cab173e19201eebeaca853ff664a9a269fed0.tar.xz
linux-9f5cab173e19201eebeaca853ff664a9a269fed0.zip
module: remove use of uninitialized variable len
clang build reports kernel/module/stats.c:307:34: error: variable 'len' is uninitialized when used here [-Werror,-Wuninitialized] len = scnprintf(buf + 0, size - len, ^~~ At the start of this sequence, neither the '+ 0', nor the '- len' are needed. So remove them and fix using 'len' uninitalized. Fixes: df3e764d8e5c ("module: add debug stats to help identify memory pressure") Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'kernel/module')
-rw-r--r--kernel/module/stats.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/module/stats.c b/kernel/module/stats.c
index a1f545479174..6eeb35cc8d9f 100644
--- a/kernel/module/stats.c
+++ b/kernel/module/stats.c
@@ -302,7 +302,7 @@ static ssize_t read_file_mod_stats(struct file *file, char __user *user_buf,
return -ENOMEM;
/* The beginning of our debug preamble */
- len = scnprintf(buf + 0, size - len, "%25s\t%u\n", "Mods ever loaded", live_mod_count);
+ len = scnprintf(buf, size, "%25s\t%u\n", "Mods ever loaded", live_mod_count);
len += scnprintf(buf + len, size - len, "%25s\t%u\n", "Mods failed on kread", fkreads);