speedtch usbatm.c,1.28,1.29

Duncan Sands duncan at infradead.org
Tue May 3 06:02:27 EDT 2005


Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv32133

Modified Files:
	usbatm.c 
Log Message:
Don't use BUG_ON in_interrupt() - it will cause the whole machine to halt.
OK, OK, if this assertion fails then we are in deep doggy do (same for the
other one), but (1) if it fails then it will probably fail during our own
testing because we made a wrong modification, so only we eat the dirt; (2)
if it fails on someone else's machine, then they are probably suffering
from memory corruption, so a little bit more won't hurt!  We could put in
all kinds of recovery code, but since it's never going to happen, that
seems kind of pointless.


Index: usbatm.c
===================================================================
RCS file: /home/cvs/speedtch/usbatm.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- usbatm.c	3 May 2005 09:42:34 -0000	1.28
+++ usbatm.c	3 May 2005 10:02:24 -0000	1.29
@@ -304,7 +304,7 @@
 	u8 pti;
 
 	for (; avail_data >= stride; avail_data -= stride, source += stride) {
-		vpi = ((source[0] & 0x0f) << 4) | (source[1] >> 4);
+		vpi = ((source[0] & 0x0f) << 4)  | (source[1] >> 4);
 		vci = ((source[1] & 0x0f) << 12) | (source[2] << 4) | (source[3] >> 4);
 		pti = ((source[3] & 0xe) >> 1);
 
@@ -337,6 +337,7 @@
 					__func__, sarb->len, vcc);
 			/* discard cells already received */
 			skb_trim(sarb, 0);
+			UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end);
 		}
 
 		memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD);
@@ -420,10 +421,8 @@
 	unsigned int num_written;
 	unsigned int stride = instance->tx_channel.stride;
 
-	/* UDSL_ASSERT(!(avail_space % instance->tx_channel.stride)); */
-	BUG_ON(avail_space % instance->tx_channel.stride);
-	vdbg("%s: skb->len=%d, avail_space=%u",
-	     __func__, skb->len, avail_space);
+	UDSL_ASSERT(!(avail_space % stride));
+	vdbg("%s: skb->len=%d, avail_space=%u", __func__, skb->len, avail_space);
 
 	for (num_written = 0; num_written < avail_space && ctrl->len;
 	     num_written += stride, target += stride) {




More information about the Usbatm-commits mailing list