Merge tag 'v4.1-defconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind...
[firefly-linux-kernel-4.4.55.git] / fs / affs / amigaffs.c
index c852f2fa17102a24935f27adb68198fe90a82f92..388da1ea815d07dd43af7a856293a4c3c840e400 100644 (file)
@@ -30,7 +30,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
        ino = bh->b_blocknr;
        offset = affs_hash_name(sb, AFFS_TAIL(sb, bh)->name + 1, AFFS_TAIL(sb, bh)->name[0]);
 
-       pr_debug("%s(dir=%u, ino=%d)\n", __func__, (u32)dir->i_ino, ino);
+       pr_debug("%s(dir=%lu, ino=%d)\n", __func__, dir->i_ino, ino);
 
        dir_bh = affs_bread(sb, dir->i_ino);
        if (!dir_bh)
@@ -80,8 +80,8 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
        sb = dir->i_sb;
        rem_ino = rem_bh->b_blocknr;
        offset = affs_hash_name(sb, AFFS_TAIL(sb, rem_bh)->name+1, AFFS_TAIL(sb, rem_bh)->name[0]);
-       pr_debug("%s(dir=%d, ino=%d, hashval=%d)\n",
-                __func__, (u32)dir->i_ino, rem_ino, offset);
+       pr_debug("%s(dir=%lu, ino=%d, hashval=%d)\n", __func__, dir->i_ino,
+                rem_ino, offset);
 
        bh = affs_bread(sb, dir->i_ino);
        if (!bh)
@@ -483,11 +483,10 @@ affs_check_name(const unsigned char *name, int len, bool notruncate)
 {
        int      i;
 
-       if (len > 30) {
+       if (len > AFFSNAMEMAX) {
                if (notruncate)
                        return -ENAMETOOLONG;
-               else
-                       len = 30;
+               len = AFFSNAMEMAX;
        }
        for (i = 0; i < len; i++) {
                if (name[i] < ' ' || name[i] == ':'
@@ -508,7 +507,7 @@ affs_check_name(const unsigned char *name, int len, bool notruncate)
 int
 affs_copy_name(unsigned char *bstr, struct dentry *dentry)
 {
-       int len = min(dentry->d_name.len, 30u);
+       u32 len = min(dentry->d_name.len, AFFSNAMEMAX);
 
        *bstr++ = len;
        memcpy(bstr, dentry->d_name.name, len);