cifs: use correct format characters
[GitHub/LineageOS/android_kernel_motorola_exynos9610.git] / fs / udf / super.c
index 99cb81d0077f940a2492e8ec109d5531adfcc7e6..242d960df9a17a2171a3824b2dea6405a05dec81 100644 (file)
@@ -703,7 +703,7 @@ static loff_t udf_check_vsd(struct super_block *sb)
        else
                sectorsize = sb->s_blocksize;
 
-       sector += (sbi->s_session << sb->s_blocksize_bits);
+       sector += (((loff_t)sbi->s_session) << sb->s_blocksize_bits);
 
        udf_debug("Starting at sector %u (%ld byte sectors)\n",
                  (unsigned int)(sector >> sb->s_blocksize_bits),
@@ -922,16 +922,20 @@ static int udf_load_pvoldesc(struct super_block *sb, sector_t block)
        }
 
        ret = udf_dstrCS0toUTF8(outstr, 31, pvoldesc->volIdent, 32);
-       if (ret < 0)
-               goto out_bh;
-
-       strncpy(UDF_SB(sb)->s_volume_ident, outstr, ret);
+       if (ret < 0) {
+               strcpy(UDF_SB(sb)->s_volume_ident, "InvalidName");
+               pr_warn("incorrect volume identification, setting to "
+                       "'InvalidName'\n");
+       } else {
+               strncpy(UDF_SB(sb)->s_volume_ident, outstr, ret);
+       }
        udf_debug("volIdent[] = '%s'\n", UDF_SB(sb)->s_volume_ident);
 
        ret = udf_dstrCS0toUTF8(outstr, 127, pvoldesc->volSetIdent, 128);
-       if (ret < 0)
+       if (ret < 0) {
+               ret = 0;
                goto out_bh;
-
+       }
        outstr[ret] = 0;
        udf_debug("volSetIdent[] = '%s'\n", outstr);
 
@@ -2091,8 +2095,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
        bool lvid_open = false;
 
        uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT);
-       uopt.uid = INVALID_UID;
-       uopt.gid = INVALID_GID;
+       /* By default we'll use overflow[ug]id when UDF inode [ug]id == -1 */
+       uopt.uid = make_kuid(current_user_ns(), overflowuid);
+       uopt.gid = make_kgid(current_user_ns(), overflowgid);
        uopt.umask = 0;
        uopt.fmode = UDF_INVALID_MODE;
        uopt.dmode = UDF_INVALID_MODE;