aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs/btree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/befs/btree.c')
-rw-r--r--fs/befs/btree.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index a2cd305a993a..9c7faa8a9288 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -318,7 +318,7 @@ befs_btree_find(struct super_block *sb, befs_data_stream * ds,
318 * befs_find_key - Search for a key within a node 318 * befs_find_key - Search for a key within a node
319 * @sb: Filesystem superblock 319 * @sb: Filesystem superblock
320 * @node: Node to find the key within 320 * @node: Node to find the key within
321 * @key: Keystring to search for 321 * @findkey: Keystring to search for
322 * @value: If key is found, the value stored with the key is put here 322 * @value: If key is found, the value stored with the key is put here
323 * 323 *
324 * finds exact match if one exists, and returns BEFS_BT_MATCH 324 * finds exact match if one exists, and returns BEFS_BT_MATCH
@@ -405,7 +405,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node,
405 * Heres how it works: Key_no is the index of the key/value pair to 405 * Heres how it works: Key_no is the index of the key/value pair to
406 * return in keybuf/value. 406 * return in keybuf/value.
407 * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is 407 * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is
408 * the number of charecters in the key (just a convenience). 408 * the number of characters in the key (just a convenience).
409 * 409 *
410 * Algorithm: 410 * Algorithm:
411 * Get the first leafnode of the tree. See if the requested key is in that 411 * Get the first leafnode of the tree. See if the requested key is in that
@@ -502,12 +502,11 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds,
502 "for key of size %d", __func__, bufsize, keylen); 502 "for key of size %d", __func__, bufsize, keylen);
503 brelse(this_node->bh); 503 brelse(this_node->bh);
504 goto error_alloc; 504 goto error_alloc;
505 }; 505 }
506 506
507 strncpy(keybuf, keystart, keylen); 507 strlcpy(keybuf, keystart, keylen + 1);
508 *value = fs64_to_cpu(sb, valarray[cur_key]); 508 *value = fs64_to_cpu(sb, valarray[cur_key]);
509 *keysize = keylen; 509 *keysize = keylen;
510 keybuf[keylen] = '\0';
511 510
512 befs_debug(sb, "Read [%llu,%d]: Key \"%.*s\", Value %llu", node_off, 511 befs_debug(sb, "Read [%llu,%d]: Key \"%.*s\", Value %llu", node_off,
513 cur_key, keylen, keybuf, *value); 512 cur_key, keylen, keybuf, *value);
@@ -707,7 +706,7 @@ befs_bt_get_key(struct super_block *sb, befs_btree_node * node,
707 * @key1: pointer to the first key to be compared 706 * @key1: pointer to the first key to be compared
708 * @keylen1: length in bytes of key1 707 * @keylen1: length in bytes of key1
709 * @key2: pointer to the second key to be compared 708 * @key2: pointer to the second key to be compared
710 * @kelen2: length in bytes of key2 709 * @keylen2: length in bytes of key2
711 * 710 *
712 * Returns 0 if @key1 and @key2 are equal. 711 * Returns 0 if @key1 and @key2 are equal.
713 * Returns >0 if @key1 is greater. 712 * Returns >0 if @key1 is greater.