diff options
Diffstat (limited to 'fs/affs/amigaffs.c')
-rw-r--r-- | fs/affs/amigaffs.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index c852f2fa1710..388da1ea815d 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c | |||
@@ -30,7 +30,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh) | |||
30 | ino = bh->b_blocknr; | 30 | ino = bh->b_blocknr; |
31 | offset = affs_hash_name(sb, AFFS_TAIL(sb, bh)->name + 1, AFFS_TAIL(sb, bh)->name[0]); | 31 | offset = affs_hash_name(sb, AFFS_TAIL(sb, bh)->name + 1, AFFS_TAIL(sb, bh)->name[0]); |
32 | 32 | ||
33 | pr_debug("%s(dir=%u, ino=%d)\n", __func__, (u32)dir->i_ino, ino); | 33 | pr_debug("%s(dir=%lu, ino=%d)\n", __func__, dir->i_ino, ino); |
34 | 34 | ||
35 | dir_bh = affs_bread(sb, dir->i_ino); | 35 | dir_bh = affs_bread(sb, dir->i_ino); |
36 | if (!dir_bh) | 36 | if (!dir_bh) |
@@ -80,8 +80,8 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh) | |||
80 | sb = dir->i_sb; | 80 | sb = dir->i_sb; |
81 | rem_ino = rem_bh->b_blocknr; | 81 | rem_ino = rem_bh->b_blocknr; |
82 | offset = affs_hash_name(sb, AFFS_TAIL(sb, rem_bh)->name+1, AFFS_TAIL(sb, rem_bh)->name[0]); | 82 | offset = affs_hash_name(sb, AFFS_TAIL(sb, rem_bh)->name+1, AFFS_TAIL(sb, rem_bh)->name[0]); |
83 | pr_debug("%s(dir=%d, ino=%d, hashval=%d)\n", | 83 | pr_debug("%s(dir=%lu, ino=%d, hashval=%d)\n", __func__, dir->i_ino, |
84 | __func__, (u32)dir->i_ino, rem_ino, offset); | 84 | rem_ino, offset); |
85 | 85 | ||
86 | bh = affs_bread(sb, dir->i_ino); | 86 | bh = affs_bread(sb, dir->i_ino); |
87 | if (!bh) | 87 | if (!bh) |
@@ -483,11 +483,10 @@ affs_check_name(const unsigned char *name, int len, bool notruncate) | |||
483 | { | 483 | { |
484 | int i; | 484 | int i; |
485 | 485 | ||
486 | if (len > 30) { | 486 | if (len > AFFSNAMEMAX) { |
487 | if (notruncate) | 487 | if (notruncate) |
488 | return -ENAMETOOLONG; | 488 | return -ENAMETOOLONG; |
489 | else | 489 | len = AFFSNAMEMAX; |
490 | len = 30; | ||
491 | } | 490 | } |
492 | for (i = 0; i < len; i++) { | 491 | for (i = 0; i < len; i++) { |
493 | if (name[i] < ' ' || name[i] == ':' | 492 | if (name[i] < ' ' || name[i] == ':' |
@@ -508,7 +507,7 @@ affs_check_name(const unsigned char *name, int len, bool notruncate) | |||
508 | int | 507 | int |
509 | affs_copy_name(unsigned char *bstr, struct dentry *dentry) | 508 | affs_copy_name(unsigned char *bstr, struct dentry *dentry) |
510 | { | 509 | { |
511 | int len = min(dentry->d_name.len, 30u); | 510 | u32 len = min(dentry->d_name.len, AFFSNAMEMAX); |
512 | 511 | ||
513 | *bstr++ = len; | 512 | *bstr++ = len; |
514 | memcpy(bstr, dentry->d_name.name, len); | 513 | memcpy(bstr, dentry->d_name.name, len); |