Skip to contentSkip to conversation

remove redundant BUG_ON

PATCH In review Roel Kluin 2 participants 2 messages Jun 22, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 remove redundant BUG_ON

sg_count is unsigned so if negative a wrap occurs and the second BUG_ON catches it.

---

drivers/scsi/fnic/fnic_scsi.c +0 -1
index eabf365..c57cff4 100644
@@ -260,7 +260,6 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
 	char msg[2];
 
 	if (sg_count) {
-		BUG_ON(sg_count < 0);
 		BUG_ON(sg_count > FNIC_MAX_SG_DESC_CNT);
 
 		/* For each SGE, create a device desc entry */
#1 lore raw
Quoted 10 lines · Roel Kluin

sg_count is unsigned so if negative a wrap occurs and the second BUG_ON catches it.

---

drivers/scsi/fnic/fnic_scsi.c +0 -0
index eabf365..c57cff4 100644

drivers/scsi/fnic/fnic_scsi.c static inline int fnic_queue_wq_copy_desc(struct fnic *fnic, · line 264

Quoted 6 lines
drivers/scsi/fnic/fnic_scsi.c +0 -1
@@ -260,7 +260,6 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
 	char msg[2];
 
 	if (sg_count) {
-		BUG_ON(sg_count < 0);
 		BUG_ON(sg_count > FNIC_MAX_SG_DESC_CNT);
 

I think they both could go. The shost sg tablesize is set to FNIC_MAX_SG_DESC_CNT and fnic uses scsi_dma_map, so the block and scsi layer should be doing the right thing. If we are worried about them, then maybe we should add BUG_ONs in the common code to check for all drivers.