diff options
| author | Arnd Bergmann <[email protected]> | 2021-09-28 09:34:33 +0000 |
|---|---|---|
| committer | Petr Mladek <[email protected]> | 2021-10-04 08:28:43 +0000 |
| commit | 5aa7eea9316ceb4b57175ce04b39e498105b7e92 (patch) | |
| tree | 90257d9953e8fc1ef7b609fbaa6fc70bc816bd67 /scripts/gcc-plugins/gcc-generate-simple_ipa-pass.h | |
| parent | printk: use kvmalloc instead of kmalloc for devkmsg_user (diff) | |
| download | kernel-5aa7eea9316ceb4b57175ce04b39e498105b7e92.tar.gz kernel-5aa7eea9316ceb4b57175ce04b39e498105b7e92.zip | |
printk: avoid -Wsometimes-uninitialized warning
clang notices that the pi_get_entry() function would use
uninitialized data if it was called with a non-NULL module
pointer on a kernel that does not support modules:
kernel/printk/index.c:32:6: error: variable 'nr_entries' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (!mod) {
^~~~
kernel/printk/index.c:38:13: note: uninitialized use occurs here
if (pos >= nr_entries)
^~~~~~~~~~
kernel/printk/index.c:32:2: note: remove the 'if' if its condition is always true
if (!mod) {
Rework the condition to make it clear to the compiler that we are always
in the second case. Unfortunately the #ifdef is still required as the
definition of 'struct module' is hidden when modules are disabled.
Fixes: 337015573718 ("printk: Userspace format indexing support")
Suggested-by: Steven Rostedt <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'scripts/gcc-plugins/gcc-generate-simple_ipa-pass.h')
0 files changed, 0 insertions, 0 deletions
