linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sysctl: Remove redundant assignment to first
@ 2021-05-07 10:15 Jiapeng Chong
  2021-05-07 11:26 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-05-07 10:15 UTC (permalink / raw)
  To: mcgrof
  Cc: keescook, yzaikin, ast, daniel, andrii, kafai, songliubraving,
	yhs, john.fastabend, kpsingh, linux-kernel, linux-fsdevel,
	netdev, bpf, Jiapeng Chong

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].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 kernel/sysctl.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 14edf84..58beeba 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1559,7 +1559,6 @@ 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;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sysctl: Remove redundant assignment to first
  2021-05-07 10:15 [PATCH] sysctl: Remove redundant assignment to first Jiapeng Chong
@ 2021-05-07 11:26 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2021-05-07 11:26 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: mcgrof, keescook, yzaikin, ast, daniel, andrii, kafai,
	songliubraving, yhs, john.fastabend, kpsingh, linux-kernel,
	linux-fsdevel, netdev, bpf

On Fri, May 07, 2021 at 06:15:54PM +0800, Jiapeng Chong wrote:
> 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].

While this is true, it is incomplete.  The 'first' declaration should be
moved into the 'else' arm of the 'if (write)' conditional.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-07 11:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 10:15 [PATCH] sysctl: Remove redundant assignment to first Jiapeng Chong
2021-05-07 11:26 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).