]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/md/dm-table.c
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
[karo-tx-linux.git] / drivers / md / dm-table.c
index 05befa91807a332b87676bef2cc47de92417e1eb..2fc199b0016bd5c819b42572b97dbc69dc03844c 100644 (file)
@@ -425,13 +425,15 @@ static void close_dev(struct dm_dev *d, struct mapped_device *md)
 }
 
 /*
- * If possible (ie. blk_size[major] is set), this checks an area
- * of a destination device is valid.
+ * If possible, this checks an area of a destination device is valid.
  */
 static int check_device_area(struct dm_dev *dd, sector_t start, sector_t len)
 {
-       sector_t dev_size;
-       dev_size = dd->bdev->bd_inode->i_size >> SECTOR_SHIFT;
+       sector_t dev_size = dd->bdev->bd_inode->i_size >> SECTOR_SHIFT;
+
+       if (!dev_size)
+               return 1;
+
        return ((start < dev_size) && (len <= (dev_size - start)));
 }