Subject:[PATCH 002:013]: raid0: find_zone to return NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Have the caller decide whether to report BUG() 
	when zone is incorrect

 raid0.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Signed-off-by: razb <raziebe@xxxxxxxxx>
---
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 851e631..8870acc 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -377,7 +377,7 @@ static struct strip_zone *find_zone(struct raid0_private_data *conf,
 				*sectorp = sector - z[i-1].zone_end;
 			return z + i;
 		}
-	BUG();
+	return NULL;
 }
 
 /*
@@ -481,6 +481,8 @@ static int raid0_make_request(struct request_queue *q, struct bio *bio)
 
 	sector_offset = bio->bi_sector;
 	zone =  find_zone(mddev->private, &sector_offset);
+	if (!zone)
+		BUG();
 	tmp_dev = map_sector(mddev, zone, bio->bi_sector,
 			     &sector_offset);
 	bio->bi_bdev = tmp_dev->bdev;





--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux