aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiapeng Chong <[email protected]>2021-06-30 18:54:53 -0700
committerLinus Torvalds <[email protected]>2021-07-01 11:06:04 -0700
commit9a52c5f3c8957872b2750314b56c64d9600542a9 (patch)
tree211a75473236decc109f4eda789311820b384f2f
parent3845f256a8b527127bfbd4ced21e93d9e89aa6d7 (diff)
sysctl: remove redundant assignment to first
Variable first is set to '0', but this value is never read as it is not used later on, hence it is a redundant assignment and can be removed. Clean up the following clang-analyzer warning: kernel/sysctl.c:1562:4: warning: Value stored to 'first' is never read [clang-analyzer-deadcode.DeadStores]. Link: https://lkml.kernel.org/r/1620469990-22182-1-git-send-email-jiapeng.chong@linux.alibaba.com Signed-off-by: Jiapeng Chong <[email protected]> Reported-by: Abaci Robot <[email protected]> Acked-by: Luis Chamberlain <[email protected]> Cc: Kees Cook <[email protected]> Cc: Iurii Zaikin <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Martin KaFai Lau <[email protected]> Cc: Song Liu <[email protected]> Cc: Yonghong Song <[email protected]> Cc: John Fastabend <[email protected]> Cc: KP Singh <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--kernel/sysctl.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 69d925f1e5da..bb37739f5731 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1494,7 +1494,6 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
int err = 0;
- bool first = 1;
size_t left = *lenp;
unsigned long bitmap_len = table->maxlen;
unsigned long *bitmap = *(unsigned long **) table->data;
@@ -1579,12 +1578,12 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
}
bitmap_set(tmp_bitmap, val_a, val_b - val_a + 1);
- first = 0;
proc_skip_char(&p, &left, '\n');
}
left += skipped;
} else {
unsigned long bit_a, bit_b = 0;
+ bool first = 1;
while (left) {
bit_a = find_next_bit(bitmap, bitmap_len, bit_b);