md: Don't read past end of bitmap when reading bitmap.
commit902439b20fdb34fcc0e077a9180d5ec25c80be96
authorNeilBrown <neilb@suse.de>
Fri, 19 Dec 2008 05:25:01 +0000 (19 16:25 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 14 Jan 2009 17:44:05 +0000 (14 09:44 -0800)
treea0fcd2f26732ada0a12a13a6efbb854ac7e11c14
parent3eb62a1a8c1655cf88e44158938a28ef774fdc08
md: Don't read past end of bitmap when reading bitmap.

commit a2ed9615e3222645007fc19991aedf30eed3ecfd upstream.

When we read the write-intent-bitmap off the device, we currently
read a whole number of pages.
When PAGE_SIZE is 4K, this works due to the alignment we enforce
on the superblock and bitmap.
When PAGE_SIZE is 64K, this case read past the end-of-device
which causes an error.

When we write the superblock, we ensure to clip the last page
to just be the required size.  Copy that code into the read path
to just read the required number of sectors.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/bitmap.c