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:   Wed, 28 Feb 2018 10:42:03 +0800
From:   Liu Song <liu.song11@....com.cn>
To:     richard@....at, dedekind1@...il.com, adrian.hunter@...el.com
Cc:     linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
        jiang.biao2@....com.cn, zhong.weidong@....com.cn,
        liu.song11@....com.cn
Subject: [PATCH] fs/UBIFS: make 'sum' definition closer to where it is used

Local var sum is only used in one branch, and it may be not used if 
it is defined outside the branch. Try to move the definition into 
the branch to make it closer to where it is actually used. 

Signed-off-by: Liu Song <liu.song11@....com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@....com.cn>
---
 fs/ubifs/find.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c
index 2dcf3d4..4eb11c1 100644
--- a/fs/ubifs/find.c
+++ b/fs/ubifs/find.c
@@ -233,7 +233,7 @@ static const struct ubifs_lprops *scan_for_dirty(struct ubifs_info *c,
 int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp,
 			 int min_space, int pick_free)
 {
-	int err = 0, sum, exclude_index = pick_free == 2 ? 1 : 0;
+	int err = 0, exclude_index = pick_free == 2 ? 1 : 0;
 	const struct ubifs_lprops *lp = NULL, *idx_lp = NULL;
 	struct ubifs_lpt_heap *heap, *idx_heap;
 
@@ -285,6 +285,7 @@ int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp,
 	idx_heap = &c->lpt_heap[LPROPS_DIRTY_IDX - 1];
 
 	if (idx_heap->cnt && !exclude_index) {
+		int sum;
 		idx_lp = idx_heap->arr[0];
 		sum = idx_lp->free + idx_lp->dirty;
 		/*
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ