From patchwork Thu Jul 1 01:54:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12353343 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E11DC11F68 for ; Thu, 1 Jul 2021 01:54:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C7E6D61469 for ; Thu, 1 Jul 2021 01:54:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7E6D61469 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4DB608D0262; Wed, 30 Jun 2021 21:54:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 497868D024F; Wed, 30 Jun 2021 21:54:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3057F8D0262; Wed, 30 Jun 2021 21:54:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 051918D024F for ; Wed, 30 Jun 2021 21:54:54 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D752982E090B for ; Thu, 1 Jul 2021 01:54:54 +0000 (UTC) X-FDA: 78312350508.01.7992B85 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf20.hostedemail.com (Postfix) with ESMTP id 91731D000099 for ; Thu, 1 Jul 2021 01:54:54 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 6B7F56141A; Thu, 1 Jul 2021 01:54:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1625104493; bh=Zay68I8W1NAS0TDg5JlNAJU7hfz/RJOB6jjX9bKT2uI=; h=Date:From:To:Subject:In-Reply-To:From; b=HwREGdCIKEqqsfayp5uk6HRm8706rc9zyZm1wypRcw6Hs8HswczK7L1TOLbHv9k4S MutIMAy+zoxE10a5X4RRrgstWAYfFEfHscHAWGrKz/NuptjQ0Gv+KXgY023d37Tr0d Lk3T8vGC9/8HgX41BcNjbLgU9rz+hwtmZztVIl/M= Date: Wed, 30 Jun 2021 18:54:53 -0700 From: Andrew Morton To: abaci@linux.alibaba.com, akpm@linux-foundation.org, andrii@kernel.org, ast@kernel.org, daniel@iogearbox.net, jiapeng.chong@linux.alibaba.com, john.fastabend@gmail.com, kafai@fb.com, keescook@chromium.org, kpsingh@kernel.org, linux-mm@kvack.org, mcgrof@kernel.org, mm-commits@vger.kernel.org, songliubraving@fb.com, torvalds@linux-foundation.org, yhs@fb.com, yzaikin@google.com Subject: [patch 144/192] sysctl: remove redundant assignment to first Message-ID: <20210701015453.ABOmnCugY%akpm@linux-foundation.org> In-Reply-To: <20210630184624.9ca1937310b0dd5ce66b30e7@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=HwREGdCI; spf=pass (imf20.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: c7145t1pug898wt7m6uxz75oipucer7y X-Rspamd-Queue-Id: 91731D000099 X-Rspamd-Server: rspam06 X-HE-Tag: 1625104494-43351 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Jiapeng Chong Subject: 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 Reported-by: Abaci Robot Acked-by: Luis Chamberlain Cc: Kees Cook Cc: Iurii Zaikin Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Andrii Nakryiko Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: John Fastabend Cc: KP Singh Signed-off-by: Andrew Morton --- kernel/sysctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/kernel/sysctl.c~sysctl-remove-redundant-assignment-to-first +++ a/kernel/sysctl.c @@ -1494,7 +1494,6 @@ int proc_do_large_bitmap(struct ctl_tabl 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_tabl } 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);