Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4842
b: refs/heads/master
c: f40661b
h: refs/heads/master
v: v3
  • Loading branch information
Anton Altaparmakov committed May 5, 2005
1 parent d82443d commit fef1d35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 946929d813a3bde095678526dd037ab9ac6efe35
refs/heads/master: f40661be038ce6ed9ef6a8b80307a9153bd95769
17 changes: 6 additions & 11 deletions trunk/fs/ntfs/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1392,14 +1392,11 @@ static int ntfs_writepage(struct page *page, struct writeback_control *wbc)

attr_len = le32_to_cpu(ctx->attr->data.resident.value_length);
i_size = i_size_read(vi);
kaddr = kmap_atomic(page, KM_USER0);
if (unlikely(attr_len > i_size)) {
/* Zero out of bounds area in the mft record. */
memset((u8*)ctx->attr + le16_to_cpu(
ctx->attr->data.resident.value_offset) +
i_size, 0, attr_len - i_size);
attr_len = i_size;
ctx->attr->data.resident.value_length = cpu_to_le32(attr_len);
}
kaddr = kmap_atomic(page, KM_USER0);
/* Copy the data from the page to the mft record. */
memcpy((u8*)ctx->attr +
le16_to_cpu(ctx->attr->data.resident.value_offset),
Expand Down Expand Up @@ -1831,7 +1828,7 @@ static int ntfs_prepare_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
s64 new_size;
unsigned long flags;
loff_t i_size;
struct inode *vi = page->mapping->host;
ntfs_inode *base_ni = NULL, *ni = NTFS_I(vi);
ntfs_volume *vol = ni->vol;
Expand Down Expand Up @@ -1934,13 +1931,11 @@ static int ntfs_prepare_write(struct file *file, struct page *page,
/* The total length of the attribute value. */
attr_len = le32_to_cpu(a->data.resident.value_length);
/* Fix an eventual previous failure of ntfs_commit_write(). */
read_lock_irqsave(&ni->size_lock, flags);
if (unlikely(ni->initialized_size < attr_len)) {
attr_len = ni->initialized_size;
i_size = i_size_read(vi);
if (unlikely(attr_len > i_size)) {
attr_len = i_size;
a->data.resident.value_length = cpu_to_le32(attr_len);
BUG_ON(attr_len < i_size_read(vi));
}
read_unlock_irqrestore(&ni->size_lock, flags);
/* If we do not need to resize the attribute allocation we are done. */
if (new_size <= attr_len)
goto done_unm;
Expand Down

0 comments on commit fef1d35

Please sign in to comment.