Skip to contentSkip to conversation

2.4.11 min() in tcp.c

PATCH Applied Chris Wright 2 participants 3 messages Oct 10, 2001 – Oct 11, 2001

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.4.11 min() in tcp.c

compiling 2.4.11 gives the following warning.

tcp.c:855: warning: comparison of distinct pointer types lacks a cast

the following patch, changes min() to min_t() to make size_t explicit.

thanks,
-chris

net/ipv4/tcp.c +1 -1
@@ -852,7 +852,7 @@
 
 		page = pages[poffset/PAGE_SIZE];
 		offset = poffset % PAGE_SIZE;
-		size = min(psize, PAGE_SIZE-offset);
+		size = min_t (size_t, psize, PAGE_SIZE-offset);
 
 		if (tp->send_head==NULL || (copy = mss_now - skb->len) <= 0) {
 new_segment:
#1 lore raw

From: Chris Wright <[email protected]>
Date: Wed, 10 Oct 2001 16:44:30 -0700

tcp.c:855: warning: comparison of distinct pointer types lacks a cast

the following patch, changes min() to min_t() to make size_t explicit.

Applied, but with a cleanup, please never do this:

- min(
+ min_t (

"min_t" is not a C operator, therefore no reason to put a space between "min_t" and the openning parenthesis. If you look around, this is the general coding style rule the Linux code follows:

	if ()  /* <--- space here */
	while () /* <--- and here */
	foo_function() /* <--- but not here */

For example.

Franks a lot,
David S. Miller
[email protected]