diff options
| author | Miklos Szeredi <mszeredi@suse.cz> | 2008-07-24 00:30:05 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-24 13:47:31 -0400 |
| commit | 8f2368095e25018838e1bf145041f58270ccd32e (patch) | |
| tree | c8ac94c024d0874f1955c1aa8880d3649dc7d4fc /fs/ecryptfs | |
| parent | 982363c97f8cad7aea4c3d2cfebffc1cc2d2f166 (diff) | |
ecryptfs: string copy cleanup
Clean up overcomplicated string copy, which also gets rid of this
bogus warning:
fs/ecryptfs/main.c: In function 'ecryptfs_parse_options':
include/asm/arch/string_32.h:75: warning: array subscript is above array bounds
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs')
| -rw-r--r-- | fs/ecryptfs/main.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 8876fe7c76e2..10475d93ff53 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
| @@ -301,7 +301,6 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options) | |||
| 301 | char *cipher_name_dst; | 301 | char *cipher_name_dst; |
| 302 | char *cipher_name_src; | 302 | char *cipher_name_src; |
| 303 | char *cipher_key_bytes_src; | 303 | char *cipher_key_bytes_src; |
| 304 | int cipher_name_len; | ||
| 305 | 304 | ||
| 306 | if (!options) { | 305 | if (!options) { |
| 307 | rc = -EINVAL; | 306 | rc = -EINVAL; |
| @@ -382,17 +381,12 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options) | |||
| 382 | goto out; | 381 | goto out; |
| 383 | } | 382 | } |
| 384 | if (!cipher_name_set) { | 383 | if (!cipher_name_set) { |
| 385 | cipher_name_len = strlen(ECRYPTFS_DEFAULT_CIPHER); | 384 | int cipher_name_len = strlen(ECRYPTFS_DEFAULT_CIPHER); |
| 386 | if (unlikely(cipher_name_len | 385 | |
| 387 | >= ECRYPTFS_MAX_CIPHER_NAME_SIZE)) { | 386 | BUG_ON(cipher_name_len >= ECRYPTFS_MAX_CIPHER_NAME_SIZE); |
| 388 | rc = -EINVAL; | 387 | |
| 389 | BUG(); | 388 | strcpy(mount_crypt_stat->global_default_cipher_name, |
| 390 | goto out; | 389 | ECRYPTFS_DEFAULT_CIPHER); |
| 391 | } | ||
| 392 | memcpy(mount_crypt_stat->global_default_cipher_name, | ||
| 393 | ECRYPTFS_DEFAULT_CIPHER, cipher_name_len); | ||
| 394 | mount_crypt_stat->global_default_cipher_name[cipher_name_len] | ||
| 395 | = '\0'; | ||
| 396 | } | 390 | } |
| 397 | if (!cipher_key_bytes_set) { | 391 | if (!cipher_key_bytes_set) { |
| 398 | mount_crypt_stat->global_default_cipher_key_size = 0; | 392 | mount_crypt_stat->global_default_cipher_key_size = 0; |
