Skip to content

Commit 071fb1b

Browse files
committed
Merge tag 'exfat-for-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat into master
Pull exfat fixes from Namjae Jeon: - fix overflow issue at sector calculation - fix wrong hint_stat initialization - fix wrong size update of stream entry - fix endianness of upname in name_hash computation * tag 'exfat-for-5.8-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat: exfat: fix name_hash computation on big endian systems exfat: fix wrong size update of stream entry by typo exfat: fix wrong hint_stat initialization in exfat_find_dir_entry() exfat: fix overflow issue in exfat_cluster_to_sector()
2 parents 8c26c87 + db415f7 commit 071fb1b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

fs/exfat/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,7 @@ int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei,
11121112
ret = exfat_get_next_cluster(sb, &clu.dir);
11131113
}
11141114

1115-
if (ret || clu.dir != EXFAT_EOF_CLUSTER) {
1115+
if (ret || clu.dir == EXFAT_EOF_CLUSTER) {
11161116
/* just initialized hint_stat */
11171117
hint_stat->clu = p_dir->dir;
11181118
hint_stat->eidx = 0;

fs/exfat/exfat_fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static inline bool exfat_is_last_sector_in_cluster(struct exfat_sb_info *sbi,
371371
static inline sector_t exfat_cluster_to_sector(struct exfat_sb_info *sbi,
372372
unsigned int clus)
373373
{
374-
return ((clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
374+
return ((sector_t)(clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
375375
sbi->data_start_sector;
376376
}
377377

fs/exfat/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ int __exfat_truncate(struct inode *inode, loff_t new_size)
176176
ep2->dentry.stream.size = 0;
177177
} else {
178178
ep2->dentry.stream.valid_size = cpu_to_le64(new_size);
179-
ep2->dentry.stream.size = ep->dentry.stream.valid_size;
179+
ep2->dentry.stream.size = ep2->dentry.stream.valid_size;
180180
}
181181

182182
if (new_size == 0) {

fs/exfat/nls.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ static int exfat_utf8_to_utf16(struct super_block *sb,
495495
struct exfat_uni_name *p_uniname, int *p_lossy)
496496
{
497497
int i, unilen, lossy = NLS_NAME_NO_LOSSY;
498-
unsigned short upname[MAX_NAME_LENGTH + 1];
498+
__le16 upname[MAX_NAME_LENGTH + 1];
499499
unsigned short *uniname = p_uniname->name;
500500

501501
WARN_ON(!len);
@@ -519,7 +519,7 @@ static int exfat_utf8_to_utf16(struct super_block *sb,
519519
exfat_wstrchr(bad_uni_chars, *uniname))
520520
lossy |= NLS_NAME_LOSSY;
521521

522-
upname[i] = exfat_toupper(sb, *uniname);
522+
upname[i] = cpu_to_le16(exfat_toupper(sb, *uniname));
523523
uniname++;
524524
}
525525

@@ -597,7 +597,7 @@ static int exfat_nls_to_ucs2(struct super_block *sb,
597597
struct exfat_uni_name *p_uniname, int *p_lossy)
598598
{
599599
int i = 0, unilen = 0, lossy = NLS_NAME_NO_LOSSY;
600-
unsigned short upname[MAX_NAME_LENGTH + 1];
600+
__le16 upname[MAX_NAME_LENGTH + 1];
601601
unsigned short *uniname = p_uniname->name;
602602
struct nls_table *nls = EXFAT_SB(sb)->nls_io;
603603

@@ -611,7 +611,7 @@ static int exfat_nls_to_ucs2(struct super_block *sb,
611611
exfat_wstrchr(bad_uni_chars, *uniname))
612612
lossy |= NLS_NAME_LOSSY;
613613

614-
upname[unilen] = exfat_toupper(sb, *uniname);
614+
upname[unilen] = cpu_to_le16(exfat_toupper(sb, *uniname));
615615
uniname++;
616616
unilen++;
617617
}

0 commit comments

Comments
 (0)