diff options
author | Anton Altaparmakov <aia21@cantab.net> | 2004-11-11 06:18:10 -0500 |
---|---|---|
committer | Anton Altaparmakov <aia21@cantab.net> | 2005-05-04 09:24:16 -0400 |
commit | da28438cae9a271c5c232177f81dfb243de9b7fa (patch) | |
tree | 40817e52c229dbb288f6425b2056c1ad61ad6470 | |
parent | 8800cea62025a5209d110c5fa5990429239d6eee (diff) |
NTFS: Use i_size_read() in fs/ntfs/attrib.c::ntfs_attr_set().
Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
-rw-r--r-- | fs/ntfs/ChangeLog | 1 | ||||
-rw-r--r-- | fs/ntfs/Makefile | 2 | ||||
-rw-r--r-- | fs/ntfs/attrib.c | 6 |
3 files changed, 7 insertions, 2 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index 1d2ad15f1533..9c4e78a8e4b1 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog | |||
@@ -31,6 +31,7 @@ ToDo/Notes: | |||
31 | compiled without debug. This avoids a possible denial of service | 31 | compiled without debug. This avoids a possible denial of service |
32 | attack. Thanks to Carl-Daniel Hailfinger from SuSE for pointing this | 32 | attack. Thanks to Carl-Daniel Hailfinger from SuSE for pointing this |
33 | out. | 33 | out. |
34 | - Use i_size_read() in fs/ntfs/attrib.c::ntfs_attr_set(). | ||
34 | 35 | ||
35 | 2.1.22 - Many bug and race fixes and error handling improvements. | 36 | 2.1.22 - Many bug and race fixes and error handling improvements. |
36 | 37 | ||
diff --git a/fs/ntfs/Makefile b/fs/ntfs/Makefile index 7b66381a0b0f..f8c97d41226b 100644 --- a/fs/ntfs/Makefile +++ b/fs/ntfs/Makefile | |||
@@ -6,7 +6,7 @@ ntfs-objs := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \ | |||
6 | index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \ | 6 | index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \ |
7 | unistr.o upcase.o | 7 | unistr.o upcase.o |
8 | 8 | ||
9 | EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.22\" | 9 | EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.23-WIP\" |
10 | 10 | ||
11 | ifeq ($(CONFIG_NTFS_DEBUG),y) | 11 | ifeq ($(CONFIG_NTFS_DEBUG),y) |
12 | EXTRA_CFLAGS += -DDEBUG | 12 | EXTRA_CFLAGS += -DDEBUG |
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c index 1ff7f90a18b0..7d668466dcd7 100644 --- a/fs/ntfs/attrib.c +++ b/fs/ntfs/attrib.c | |||
@@ -1127,6 +1127,10 @@ int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) | |||
1127 | * byte offset @ofs inside the attribute with the constant byte @val. | 1127 | * byte offset @ofs inside the attribute with the constant byte @val. |
1128 | * | 1128 | * |
1129 | * This function is effectively like memset() applied to an ntfs attribute. | 1129 | * This function is effectively like memset() applied to an ntfs attribute. |
1130 | * Note thie function actually only operates on the page cache pages belonging | ||
1131 | * to the ntfs attribute and it marks them dirty after doing the memset(). | ||
1132 | * Thus it relies on the vm dirty page write code paths to cause the modified | ||
1133 | * pages to be written to the mft record/disk. | ||
1130 | * | 1134 | * |
1131 | * Return 0 on success and -errno on error. An error code of -ESPIPE means | 1135 | * Return 0 on success and -errno on error. An error code of -ESPIPE means |
1132 | * that @ofs + @cnt were outside the end of the attribute and no write was | 1136 | * that @ofs + @cnt were outside the end of the attribute and no write was |
@@ -1155,7 +1159,7 @@ int ntfs_attr_set(ntfs_inode *ni, const s64 ofs, const s64 cnt, const u8 val) | |||
1155 | end = ofs + cnt; | 1159 | end = ofs + cnt; |
1156 | end_ofs = end & ~PAGE_CACHE_MASK; | 1160 | end_ofs = end & ~PAGE_CACHE_MASK; |
1157 | /* If the end is outside the inode size return -ESPIPE. */ | 1161 | /* If the end is outside the inode size return -ESPIPE. */ |
1158 | if (unlikely(end > VFS_I(ni)->i_size)) { | 1162 | if (unlikely(end > i_size_read(VFS_I(ni)))) { |
1159 | ntfs_error(vol->sb, "Request exceeds end of attribute."); | 1163 | ntfs_error(vol->sb, "Request exceeds end of attribute."); |
1160 | return -ESPIPE; | 1164 | return -ESPIPE; |
1161 | } | 1165 | } |