]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ocfs2: Safer read_inline_data()
authorJan Kara <jack@suse.cz>
Wed, 19 Dec 2007 14:24:09 +0000 (15:24 +0100)
committerMark Fasheh <mark.fasheh@oracle.com>
Fri, 25 Jan 2008 23:05:44 +0000 (15:05 -0800)
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>
fs/ocfs2/aops.c

index 286af3a11383903db4ae33fa1fccea328966896b..bc7b4cbbe8eca6f418761b64d0ff8f24141242b0 100644 (file)
@@ -217,7 +217,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page,
                           struct buffer_head *di_bh)
 {
        void *kaddr;
-       unsigned int size;
+       loff_t size;
        struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
 
        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,
        if (size > PAGE_CACHE_SIZE ||
            size > ocfs2_max_inline_data(inode->i_sb)) {
                ocfs2_error(inode->i_sb,
-                           "Inode %llu has with inline data has bad size: %u",
-                           (unsigned long long)OCFS2_I(inode)->ip_blkno, size);
+                           "Inode %llu has with inline data has bad size: %Lu",
+                           (unsigned long long)OCFS2_I(inode)->ip_blkno,
+                           (unsigned long long)size);
                return -EROFS;
        }