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>] [day] [month] [year] [list]
Message-Id: <1470340338-32218-1-git-send-email-luisbg@osg.samsung.com>
Date:	Thu,  4 Aug 2016 20:52:18 +0100
From:	Luis de Bethencourt <luisbg@....samsung.com>
To:	linux-kernel@...r.kernel.org
Cc:	akpm@...ux-foundation.org, viro@...iv.linux.org.uk,
	salah.triki@....org, Luis de Bethencourt <luisbg@....samsung.com>
Subject: [PATCH] befs: remove unused BEFS_BT_MATCH

befs_btree_find(), the only caller of befs_find_key(), only cares about if
the return from that function is BEFS_BT_MATCH or not. It never uses the
partial match given with BEFS_BT_MATCH. Removing that return and don't set
the value that will go unused.

Signed-off-by: Luis de Bethencourt <luisbg@....samsung.com>
---
 fs/befs/befs.h  |  1 -
 fs/befs/btree.c | 27 +++++++++------------------
 2 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/fs/befs/befs.h b/fs/befs/befs.h
index c5c6cd1..faf3fac 100644
--- a/fs/befs/befs.h
+++ b/fs/befs/befs.h
@@ -79,7 +79,6 @@ enum befs_err {
 	BEFS_BT_END,
 	BEFS_BT_EMPTY,
 	BEFS_BT_MATCH,
-	BEFS_BT_PARMATCH,
 	BEFS_BT_NOT_FOUND
 };
 
diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index 3f1a391..53fe656 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -323,16 +323,10 @@ befs_btree_find(struct super_block *sb, const befs_data_stream *ds,
  * @findkey: Keystring to search for
  * @value: If key is found, the value stored with the key is put here
  *
- * finds exact match if one exists, and returns BEFS_BT_MATCH
- * If no exact match, finds first key in node that is greater
- * (alphabetically) than the search key and returns BEFS_BT_PARMATCH
- * (for partial match, I guess). Can you think of something better to
- * call it?
+ * Finds exact match if one exists, and returns BEFS_BT_MATCH.
+ * If there is no exact match, it returns BEFS_BT_NOT_FOUND.
  *
- * If no key was a match or greater than the search key, return
- * BEFS_BT_NOT_FOUND.
- *
- * Use binary search instead of a linear.
+ * Uses binary search instead of a linear.
  */
 static int
 befs_find_key(struct super_block *sb, struct befs_btree_node *node,
@@ -355,9 +349,7 @@ befs_find_key(struct super_block *sb, struct befs_btree_node *node,
 
 	eq = befs_compare_strings(thiskey, keylen, findkey, findkey_len);
 	if (eq < 0) {
-		befs_error(sb, "<--- %s %s not found", __func__, findkey);
-		befs_debug(sb, "<--- %s ERROR", __func__);
-		return BEFS_BT_NOT_FOUND;
+		goto not_found;
 	}
 
 	valarray = befs_bt_valarray(node);
@@ -385,12 +377,11 @@ befs_find_key(struct super_block *sb, struct befs_btree_node *node,
 		else
 			first = mid + 1;
 	}
-	if (eq < 0)
-		*value = fs64_to_cpu(sb, valarray[mid + 1]);
-	else
-		*value = fs64_to_cpu(sb, valarray[mid]);
-	befs_debug(sb, "<--- %s found %s at %d", __func__, thiskey, mid);
-	return BEFS_BT_PARMATCH;
+
+not_found:
+	befs_error(sb, "<--- %s %s not found", __func__, findkey);
+	befs_debug(sb, "<--- %s ERROR", __func__);
+	return BEFS_BT_NOT_FOUND;
 }
 
 /**
-- 
2.5.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ