aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/aops.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2007-12-19 09:24:09 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2008-01-25 18:05:44 -0500
commitd2849fb294d92d6eee0a811c688f1ecb39d26800 (patch)
treecdfab35099e97d64e47ebebd14067053ea08459e /fs/ocfs2/aops.c
parent5fa0613ea58a80f69852b242337121bd39dc798e (diff)
ocfs2: Safer read_inline_data()
In ocfs2_read_inline_data() we should store file size in loff_t. Although the file size should fit in 32 bits we cannot be sure in case filesystem is corrupted. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/aops.c')
-rw-r--r--fs/ocfs2/aops.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 286af3a11383..bc7b4cbbe8ec 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -217,7 +217,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
217 struct buffer_head *di_bh) 217 struct buffer_head *di_bh)
218{ 218{
219 void *kaddr; 219 void *kaddr;
220 unsigned int size; 220 loff_t size;
221 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; 221 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
222 222
223 if (!(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)) { 223 if (!(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)) {
@@ -231,8 +231,9 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
231 if (size > PAGE_CACHE_SIZE || 231 if (size > PAGE_CACHE_SIZE ||
232 size > ocfs2_max_inline_data(inode->i_sb)) { 232 size > ocfs2_max_inline_data(inode->i_sb)) {
233 ocfs2_error(inode->i_sb, 233 ocfs2_error(inode->i_sb,
234 "Inode %llu has with inline data has bad size: %u", 234 "Inode %llu has with inline data has bad size: %Lu",
235 (unsigned long long)OCFS2_I(inode)->ip_blkno, size); 235 (unsigned long long)OCFS2_I(inode)->ip_blkno,
236 (unsigned long long)size);
236 return -EROFS; 237 return -EROFS;
237 } 238 }
238 239