Commit f9114ec4 authored by Joe Thornber's avatar Joe Thornber Committed by Linus Torvalds

[PATCH] dm: fix check_device_area compare

check_device_area was comparing the bytes with sectors.
[Stefan Lauterbach]
parent 2e8a5e48
...@@ -388,7 +388,7 @@ static void close_dev(struct dm_dev *d) ...@@ -388,7 +388,7 @@ static void close_dev(struct dm_dev *d)
static int check_device_area(struct dm_dev *dd, sector_t start, sector_t len) static int check_device_area(struct dm_dev *dd, sector_t start, sector_t len)
{ {
sector_t dev_size; sector_t dev_size;
dev_size = dd->bdev->bd_inode->i_size; dev_size = dd->bdev->bd_inode->i_size >> SECTOR_SHIFT;
return ((start < dev_size) && (len <= (dev_size - start))); return ((start < dev_size) && (len <= (dev_size - start)));
} }
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
static const char *_name = DM_NAME; static const char *_name = DM_NAME;
#define MAX_DEVICES (1 << KDEV_MINOR_BITS) #define MAX_DEVICES (1 << KDEV_MINOR_BITS)
#define SECTOR_SHIFT 9
static int major = 0; static int major = 0;
static int _major = 0; static int _major = 0;
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#define SECTOR_FORMAT "%lu" #define SECTOR_FORMAT "%lu"
#endif #endif
#define SECTOR_SHIFT 9
extern struct block_device_operations dm_blk_dops; extern struct block_device_operations dm_blk_dops;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment