lkml.org 
[lkml]   [2007]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [patch] md: bitmap read_page error
On Tuesday January 23, yinyang801120@gmail.com wrote:
> I think your patch is not enough to slove the read_page error
> completely. I think in the bitmap_init_from_disk we also need to check
> the 'count' never exceeds the size of file before calling the
> read_page function. How do your think about it.
> Thanks your reply.

bitmap_init_from_disk already has a test:

if (file && i_size_read(file->f_mapping->host) < bytes + sizeof(bitmap_super_t)) {
printk(KERN_INFO "%s: bitmap file too short %lu < %lu\n",
bmname(bitmap),
(unsigned long) i_size_read(file->f_mapping->host),
bytes + sizeof(bitmap_super_t));
goto out;
}

so 'bytes' of the bitmap must fit entirely within the file, and count
is set:
if (index == num_pages-1)
count = bytes + sizeof(bitmap_super_t)
- index * PAGE_SIZE;
else
count = PAGE_SIZE;
which ensures that it will not go beyond the end of the file.

So I don't think count can ever exceed the size of the file in this
case.

Can you still see a problem?

Thanks,
NeilBrown
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-01-24 04:13    [W:0.051 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site