Skip to content

Commit

Permalink
Merge tag 'exfat-for-5.8-rc7' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/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()
  • Loading branch information
torvalds committed Jul 22, 2020
2 parents 8c26c87 + db415f7 commit 071fb1b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion fs/exfat/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ int exfat_find_dir_entry(struct super_block *sb, struct exfat_inode_info *ei,
ret = exfat_get_next_cluster(sb, &clu.dir);
}

if (ret || clu.dir != EXFAT_EOF_CLUSTER) {
if (ret || clu.dir == EXFAT_EOF_CLUSTER) {
/* just initialized hint_stat */
hint_stat->clu = p_dir->dir;
hint_stat->eidx = 0;
Expand Down
2 changes: 1 addition & 1 deletion fs/exfat/exfat_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static inline bool exfat_is_last_sector_in_cluster(struct exfat_sb_info *sbi,
static inline sector_t exfat_cluster_to_sector(struct exfat_sb_info *sbi,
unsigned int clus)
{
return ((clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
return ((sector_t)(clus - EXFAT_RESERVED_CLUSTERS) << sbi->sect_per_clus_bits) +
sbi->data_start_sector;
}

Expand Down
2 changes: 1 addition & 1 deletion fs/exfat/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ int __exfat_truncate(struct inode *inode, loff_t new_size)
ep2->dentry.stream.size = 0;
} else {
ep2->dentry.stream.valid_size = cpu_to_le64(new_size);
ep2->dentry.stream.size = ep->dentry.stream.valid_size;
ep2->dentry.stream.size = ep2->dentry.stream.valid_size;
}

if (new_size == 0) {
Expand Down
8 changes: 4 additions & 4 deletions fs/exfat/nls.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ static int exfat_utf8_to_utf16(struct super_block *sb,
struct exfat_uni_name *p_uniname, int *p_lossy)
{
int i, unilen, lossy = NLS_NAME_NO_LOSSY;
unsigned short upname[MAX_NAME_LENGTH + 1];
__le16 upname[MAX_NAME_LENGTH + 1];
unsigned short *uniname = p_uniname->name;

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

upname[i] = exfat_toupper(sb, *uniname);
upname[i] = cpu_to_le16(exfat_toupper(sb, *uniname));
uniname++;
}

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

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

upname[unilen] = exfat_toupper(sb, *uniname);
upname[unilen] = cpu_to_le16(exfat_toupper(sb, *uniname));
uniname++;
unilen++;
}
Expand Down

0 comments on commit 071fb1b

Please sign in to comment.