]> Pileus Git - ~andy/linux/blobdiff - drivers/scsi/scsi_debug.c
SCSI: remove fake "address-of" expression
[~andy/linux] / drivers / scsi / scsi_debug.c
index 136329b4027bfc4201874f726911ae87290527b4..b02bdc6c2cd1f8beb26b4706e81d72e3860ad6d1 100644 (file)
@@ -1991,7 +1991,8 @@ static void map_region(sector_t lba, unsigned int len)
                block = lba + alignment;
                rem = do_div(block, granularity);
 
-               set_bit(block, map_storep);
+               if (block < map_size)
+                       set_bit(block, map_storep);
 
                lba += granularity - rem;
        }
@@ -2011,7 +2012,8 @@ static void unmap_region(sector_t lba, unsigned int len)
                block = lba + alignment;
                rem = do_div(block, granularity);
 
-               if (rem == 0 && lba + granularity <= end)
+               if (rem == 0 && lba + granularity <= end &&
+                   block < map_size)
                        clear_bit(block, map_storep);
 
                lba += granularity - rem;