lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 17 May 2021 17:46:50 +0800
From:   Yang Li <yang.lee@...ux.alibaba.com>
To:     clm@...com
Cc:     josef@...icpanda.com, dsterba@...e.com, nathan@...nel.org,
        ndesaulniers@...gle.com, linux-btrfs@...r.kernel.org,
        lukas.bulwahn@...il.com, linux-kernel@...r.kernel.org,
        clang-built-linux@...glegroups.com,
        Yang Li <yang.lee@...ux.alibaba.com>
Subject: [PATCH v2] btrfs: Remove redundant initialization of 'to_add'

Variable 'to_add' is being initialized however this value is never
read as 'to_add' is assigned a new value in if statement. Remove the
redundant assignment. At the same time, move its declaration into the
if statement, because the variable is not used elsewhere.

Clean up clang warning:

fs/btrfs/extent-tree.c:2774:8: warning: Value stored to 'to_add' during
its initialization is never read [clang-analyzer-deadcode.DeadStores]

Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@...ux.alibaba.com>
---

Change in v2:
--According to Lukas's suggestion, combine the declaration and assignment of 
  variable 'to_add' into one line, just as "u64 to_add = min(len, ...);"
  https://lore.kernel.org/patchwork/patch/1428697/

 fs/btrfs/extent-tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index f1d15b6..13ac978 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2774,11 +2774,9 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,
 		spin_unlock(&cache->lock);
 		if (!readonly && return_free_space &&
 		    global_rsv->space_info == space_info) {
-			u64 to_add = len;
-
 			spin_lock(&global_rsv->lock);
 			if (!global_rsv->full) {
-				to_add = min(len, global_rsv->size -
+				u64 to_add = min(len, global_rsv->size -
 					     global_rsv->reserved);
 				global_rsv->reserved += to_add;
 				btrfs_space_info_update_bytes_may_use(fs_info,
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ