patch-2.4.10 linux/drivers/isdn/pcbit/layer2.c

Next file: linux/drivers/isdn/pcbit/layer2.h
Previous file: linux/drivers/isdn/isdnloop/isdnloop.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/drivers/isdn/pcbit/layer2.c linux/drivers/isdn/pcbit/layer2.c
@@ -176,7 +176,6 @@
 	struct frame_buf *frame = NULL;
 	unsigned char unacked;
 	int flen;               /* fragment frame length including all headers */
-	int totlen;             /* non-fragmented frame length */
 	int free;
 	int count,
 	 cp_len;
@@ -213,11 +212,12 @@
 			ulong 	msg;
 
 			if (frame->skb)
-				totlen = FRAME_HDR_LEN + PREHDR_LEN + frame->skb->len;
+				flen = FRAME_HDR_LEN + PREHDR_LEN + frame->skb->len;
 			else
-				totlen = FRAME_HDR_LEN + PREHDR_LEN;
+				flen = FRAME_HDR_LEN + PREHDR_LEN;
 
-			flen = MIN(totlen, free);
+			if (flen > free)
+				flen = free;
 
 			msg = frame->msg;
 
@@ -259,9 +259,10 @@
 		} else {
 			/* Type 1 frame */
 
-			totlen = 2 + (frame->skb->len - frame->copied);
+			flen = 2 + (frame->skb->len - frame->copied);
 
-			flen = MIN(totlen, free);
+			if (flen > free)
+				flen = free;
 
 			/* TT */
 			tt = ((ushort) (flen - 2)) | 0x8000U;	/* Type 1 */
@@ -271,8 +272,9 @@
 		}
 
 		if (frame->skb) {
-			cp_len = MIN(frame->skb->len - frame->copied,
-				     flen - count);
+			cp_len = frame->skb->len - frame->copied;
+			if (cp_len > flen - count)
+				cp_len = flen - count;
 
 			memcpy_topcbit(dev, frame->skb->data + frame->copied,
 				       cp_len);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)