Commit 5c1c88cd authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'v6.5/fs.ntfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull ntfs updates from Christian Brauner:
 "A pile of various smaller fixes for ntfs"

* tag 'v6.5/fs.ntfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  ntfs: do not dereference a null ctx on error
  ntfs: Remove unneeded semicolon
  ntfs: Correct spelling
  ntfs: remove redundant initialization to pointer cb_sb_start
parents 1f268d6d aa4b92c5
...@@ -2491,7 +2491,7 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size, ...@@ -2491,7 +2491,7 @@ s64 ntfs_attr_extend_allocation(ntfs_inode *ni, s64 new_alloc_size,
* byte offset @ofs inside the attribute with the constant byte @val. * byte offset @ofs inside the attribute with the constant byte @val.
* *
* This function is effectively like memset() applied to an ntfs attribute. * This function is effectively like memset() applied to an ntfs attribute.
* Note thie function actually only operates on the page cache pages belonging * Note this function actually only operates on the page cache pages belonging
* to the ntfs attribute and it marks them dirty after doing the memset(). * to the ntfs attribute and it marks them dirty after doing the memset().
* Thus it relies on the vm dirty page write code paths to cause the modified * Thus it relies on the vm dirty page write code paths to cause the modified
* pages to be written to the mft record/disk. * pages to be written to the mft record/disk.
......
...@@ -161,7 +161,7 @@ static int ntfs_decompress(struct page *dest_pages[], int completed_pages[], ...@@ -161,7 +161,7 @@ static int ntfs_decompress(struct page *dest_pages[], int completed_pages[],
*/ */
u8 *cb_end = cb_start + cb_size; /* End of cb. */ u8 *cb_end = cb_start + cb_size; /* End of cb. */
u8 *cb = cb_start; /* Current position in cb. */ u8 *cb = cb_start; /* Current position in cb. */
u8 *cb_sb_start = cb; /* Beginning of the current sb in the cb. */ u8 *cb_sb_start; /* Beginning of the current sb in the cb. */
u8 *cb_sb_end; /* End of current sb / beginning of next sb. */ u8 *cb_sb_end; /* End of current sb / beginning of next sb. */
/* Variables for uncompressed data / destination. */ /* Variables for uncompressed data / destination. */
......
...@@ -1955,36 +1955,38 @@ static int ntfs_mft_data_extend_allocation_nolock(ntfs_volume *vol) ...@@ -1955,36 +1955,38 @@ static int ntfs_mft_data_extend_allocation_nolock(ntfs_volume *vol)
"attribute.%s", es); "attribute.%s", es);
NVolSetErrors(vol); NVolSetErrors(vol);
} }
a = ctx->attr;
if (ntfs_rl_truncate_nolock(vol, &mft_ni->runlist, old_last_vcn)) { if (ntfs_rl_truncate_nolock(vol, &mft_ni->runlist, old_last_vcn)) {
ntfs_error(vol->sb, "Failed to truncate mft data attribute " ntfs_error(vol->sb, "Failed to truncate mft data attribute "
"runlist.%s", es); "runlist.%s", es);
NVolSetErrors(vol); NVolSetErrors(vol);
} }
if (mp_rebuilt && !IS_ERR(ctx->mrec)) { if (ctx) {
if (ntfs_mapping_pairs_build(vol, (u8*)a + le16_to_cpu( a = ctx->attr;
if (mp_rebuilt && !IS_ERR(ctx->mrec)) {
if (ntfs_mapping_pairs_build(vol, (u8 *)a + le16_to_cpu(
a->data.non_resident.mapping_pairs_offset), a->data.non_resident.mapping_pairs_offset),
old_alen - le16_to_cpu( old_alen - le16_to_cpu(
a->data.non_resident.mapping_pairs_offset), a->data.non_resident.mapping_pairs_offset),
rl2, ll, -1, NULL)) { rl2, ll, -1, NULL)) {
ntfs_error(vol->sb, "Failed to restore mapping pairs " ntfs_error(vol->sb, "Failed to restore mapping pairs "
"array.%s", es); "array.%s", es);
NVolSetErrors(vol); NVolSetErrors(vol);
} }
if (ntfs_attr_record_resize(ctx->mrec, a, old_alen)) { if (ntfs_attr_record_resize(ctx->mrec, a, old_alen)) {
ntfs_error(vol->sb, "Failed to restore attribute " ntfs_error(vol->sb, "Failed to restore attribute "
"record.%s", es); "record.%s", es);
NVolSetErrors(vol);
}
flush_dcache_mft_record_page(ctx->ntfs_ino);
mark_mft_record_dirty(ctx->ntfs_ino);
} else if (IS_ERR(ctx->mrec)) {
ntfs_error(vol->sb, "Failed to restore attribute search "
"context.%s", es);
NVolSetErrors(vol); NVolSetErrors(vol);
} }
flush_dcache_mft_record_page(ctx->ntfs_ino);
mark_mft_record_dirty(ctx->ntfs_ino);
} else if (IS_ERR(ctx->mrec)) {
ntfs_error(vol->sb, "Failed to restore attribute search "
"context.%s", es);
NVolSetErrors(vol);
}
if (ctx)
ntfs_attr_put_search_ctx(ctx); ntfs_attr_put_search_ctx(ctx);
}
if (!IS_ERR(mrec)) if (!IS_ERR(mrec))
unmap_mft_record(mft_ni); unmap_mft_record(mft_ni);
up_write(&mft_ni->runlist.lock); up_write(&mft_ni->runlist.lock);
......
...@@ -1620,7 +1620,7 @@ static bool load_and_init_attrdef(ntfs_volume *vol) ...@@ -1620,7 +1620,7 @@ static bool load_and_init_attrdef(ntfs_volume *vol)
memcpy((u8*)vol->attrdef + (index++ << PAGE_SHIFT), memcpy((u8*)vol->attrdef + (index++ << PAGE_SHIFT),
page_address(page), size); page_address(page), size);
ntfs_unmap_page(page); ntfs_unmap_page(page);
}; }
if (size == PAGE_SIZE) { if (size == PAGE_SIZE) {
size = i_size & ~PAGE_MASK; size = i_size & ~PAGE_MASK;
if (size) if (size)
...@@ -1689,7 +1689,7 @@ static bool load_and_init_upcase(ntfs_volume *vol) ...@@ -1689,7 +1689,7 @@ static bool load_and_init_upcase(ntfs_volume *vol)
memcpy((char*)vol->upcase + (index++ << PAGE_SHIFT), memcpy((char*)vol->upcase + (index++ << PAGE_SHIFT),
page_address(page), size); page_address(page), size);
ntfs_unmap_page(page); ntfs_unmap_page(page);
}; }
if (size == PAGE_SIZE) { if (size == PAGE_SIZE) {
size = i_size & ~PAGE_MASK; size = i_size & ~PAGE_MASK;
if (size) if (size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment