Commit d2849fb294d92d6eee0a811c688f1ecb39d26800
Committed by
Mark Fasheh
1 parent
5fa0613ea5
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>
Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff
fs/ocfs2/aops.c
... | ... | @@ -217,7 +217,7 @@ |
217 | 217 | struct buffer_head *di_bh) |
218 | 218 | { |
219 | 219 | void *kaddr; |
220 | - unsigned int size; | |
220 | + loff_t size; | |
221 | 221 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; |
222 | 222 | |
223 | 223 | if (!(le16_to_cpu(di->i_dyn_features) & OCFS2_INLINE_DATA_FL)) { |
... | ... | @@ -231,8 +231,9 @@ |
231 | 231 | if (size > PAGE_CACHE_SIZE || |
232 | 232 | size > ocfs2_max_inline_data(inode->i_sb)) { |
233 | 233 | ocfs2_error(inode->i_sb, |
234 | - "Inode %llu has with inline data has bad size: %u", | |
235 | - (unsigned long long)OCFS2_I(inode)->ip_blkno, size); | |
234 | + "Inode %llu has with inline data has bad size: %Lu", | |
235 | + (unsigned long long)OCFS2_I(inode)->ip_blkno, | |
236 | + (unsigned long long)size); | |
236 | 237 | return -EROFS; |
237 | 238 | } |
238 | 239 |