All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove redundant BUG_ON
@ 2009-06-22 17:54 Roel Kluin
  2009-06-22 18:15 ` Abhijeet Joglekar (abjoglek)
  2009-06-22 23:06 ` [PATCH] fnic: remove redundant BUG_ONs and fix checks on unsigned Roel Kluin
  0 siblings, 2 replies; 3+ messages in thread
From: Roel Kluin @ 2009-06-22 17:54 UTC (permalink / raw)
  To: abjoglek; +Cc: linux-scsi, Andrew Morton

sg_count is unsigned. If negative, a wrap causes the second BUG_ON to trigger.

scsi_dma_map may return -ENOMEM, sg_count should be int to catch that.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Please use this one instead.

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index eabf365..22a7cd5 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -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 */
@@ -344,7 +343,7 @@ int fnic_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
 	struct fnic *fnic;
 	struct vnic_wq_copy *wq;
 	int ret;
-	u32 sg_count;
+	int sg_count;
 	unsigned long flags;
 	unsigned long ptr;
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-22 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-22 17:54 [PATCH] remove redundant BUG_ON Roel Kluin
2009-06-22 18:15 ` Abhijeet Joglekar (abjoglek)
2009-06-22 23:06 ` [PATCH] fnic: remove redundant BUG_ONs and fix checks on unsigned Roel Kluin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.