aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/befs')
-rw-r--r--fs/befs/btree.c11
-rw-r--r--fs/befs/datastream.c2
-rw-r--r--fs/befs/linuxvfs.c29
3 files changed, 16 insertions, 26 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.
diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c
index c467bebd50af..1e8e0b8d8836 100644
--- a/fs/befs/datastream.c
+++ b/fs/befs/datastream.c
@@ -116,7 +116,7 @@ befs_fblock2brun(struct super_block *sb, befs_data_stream * data,
116 * befs_read_lsmylink - read long symlink from datastream. 116 * befs_read_lsmylink - read long symlink from datastream.
117 * @sb: Filesystem superblock 117 * @sb: Filesystem superblock
118 * @ds: Datastrem to read from 118 * @ds: Datastrem to read from
119 * @buf: Buffer in which to place long symlink data 119 * @buff: Buffer in which to place long symlink data
120 * @len: Length of the long symlink in bytes 120 * @len: Length of the long symlink in bytes
121 * 121 *
122 * Returns the number of bytes read 122 * Returns the number of bytes read
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index d626756ff721..a16fbd4e8241 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -133,14 +133,6 @@ befs_get_block(struct inode *inode, sector_t block,
133 133
134 befs_debug(sb, "---> befs_get_block() for inode %lu, block %ld", 134 befs_debug(sb, "---> befs_get_block() for inode %lu, block %ld",
135 (unsigned long)inode->i_ino, (long)block); 135 (unsigned long)inode->i_ino, (long)block);
136
137 if (block < 0) {
138 befs_error(sb, "befs_get_block() was asked for a block "
139 "number less than zero: block %ld in inode %lu",
140 (long)block, (unsigned long)inode->i_ino);
141 return -EIO;
142 }
143
144 if (create) { 136 if (create) {
145 befs_error(sb, "befs_get_block() was asked to write to " 137 befs_error(sb, "befs_get_block() was asked to write to "
146 "block %ld in inode %lu", (long)block, 138 "block %ld in inode %lu", (long)block,
@@ -396,9 +388,8 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
396 if (S_ISLNK(inode->i_mode) && !(befs_ino->i_flags & BEFS_LONG_SYMLINK)){ 388 if (S_ISLNK(inode->i_mode) && !(befs_ino->i_flags & BEFS_LONG_SYMLINK)){
397 inode->i_size = 0; 389 inode->i_size = 0;
398 inode->i_blocks = befs_sb->block_size / VFS_BLOCK_SIZE; 390 inode->i_blocks = befs_sb->block_size / VFS_BLOCK_SIZE;
399 strncpy(befs_ino->i_data.symlink, raw_inode->data.symlink, 391 strlcpy(befs_ino->i_data.symlink, raw_inode->data.symlink,
400 BEFS_SYMLINK_LEN - 1); 392 BEFS_SYMLINK_LEN);
401 befs_ino->i_data.symlink[BEFS_SYMLINK_LEN - 1] = '\0';
402 } else { 393 } else {
403 int num_blks; 394 int num_blks;
404 395
@@ -591,21 +582,21 @@ befs_utf2nls(struct super_block *sb, const char *in,
591/** 582/**
592 * befs_nls2utf - Convert NLS string to utf8 encodeing 583 * befs_nls2utf - Convert NLS string to utf8 encodeing
593 * @sb: Superblock 584 * @sb: Superblock
594 * @src: Input string buffer in NLS format 585 * @in: Input string buffer in NLS format
595 * @srclen: Length of input string in bytes 586 * @in_len: Length of input string in bytes
596 * @dest: The output string in UTF-8 format 587 * @out: The output string in UTF-8 format
597 * @destlen: Length of the output buffer 588 * @out_len: Length of the output buffer
598 * 589 *
599 * Converts input string @src, which is in the format of the loaded NLS map, 590 * Converts input string @in, which is in the format of the loaded NLS map,
600 * into a utf8 string. 591 * into a utf8 string.
601 * 592 *
602 * The destination string @dest is allocated by this function and the caller is 593 * The destination string @out is allocated by this function and the caller is
603 * responsible for freeing it with kfree() 594 * responsible for freeing it with kfree()
604 * 595 *
605 * On return, *@destlen is the length of @dest in bytes. 596 * On return, *@out_len is the length of @out in bytes.
606 * 597 *
607 * On success, the return value is the number of utf8 characters written to 598 * On success, the return value is the number of utf8 characters written to
608 * the output buffer @dest. 599 * the output buffer @out.
609 * 600 *
610 * On Failure, a negative number coresponding to the error code is returned. 601 * On Failure, a negative number coresponding to the error code is returned.
611 */ 602 */