Skip to contentSkip to conversation

pppoe: fix compiler warning

PATCH Patrick McHardy 3 participants 4 messages Jun 24, 2008 – Jun 25, 2008

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

pppoe: fix compiler warning

Fix warning introduced by 392fdb0 (net pppoe: Check packet length on all receive paths):

drivers/net/pppoe.c: In function 'pppoe_recvmsg':
drivers/net/pppoe.c:945: warning: comparison of distinct pointer types lacks a cast

drivers/net/pppoe.c +1 -1
index bafb69b..fc6f4b8 100644
@@ -942,7 +942,7 @@ static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock,
 	m->msg_namelen = 0;
 
 	if (skb) {
-		total_len = min(total_len, skb->len);
+		total_len = min_t(size_t, total_len, skb->len);
 		error = skb_copy_datagram_iovec(skb, 0, m->msg_iov, total_len);
 		if (error == 0)
 			error = total_len;
Acked-by
#1 lore raw
Quoted 8 lines · Patrick McHardy

pppoe: fix compiler warning

Fix warning introduced by 392fdb0 (net pppoe: Check packet length on all receive paths):

drivers/net/pppoe.c: In function 'pppoe_recvmsg':
drivers/net/pppoe.c:945: warning: comparison of distinct pointer types lacks a cast

Thanks Patrick!

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#2 lore raw
In reply to Patrick McHardy

From: Patrick McHardy <[email protected]>
Date: Tue, 24 Jun 2008 18:00:06 +0200

Quoted 8 lines

pppoe: fix compiler warning

Fix warning introduced by 392fdb0 (net pppoe: Check packet length on all receive paths):

drivers/net/pppoe.c: In function 'pppoe_recvmsg':
drivers/net/pppoe.c:945: warning: comparison of distinct pointer types lacks a cast

Should already be fixed in net-2.6 by:

commit 2645a3c3761ac25498db2e627271016c849c68e1

Author: Stephen Hemminger <[email protected]>
Date:   Fri Jun 20 21:58:02 2008 -0700

pppoe: warning fix

Fix warning:
drivers/net/pppoe.c: In function 'pppoe_recvmsg':
drivers/net/pppoe.c:945: warning: comparison of distinct pointer types lacks a cast because skb->len is unsigned int and total_len is size_t

drivers/net/pppoe.c +1 -1
index bafb69b..fc6f4b8 100644
@@ -942,7 +942,7 @@ static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock,
 	m->msg_namelen = 0;
 
 	if (skb) {
-		total_len = min(total_len, skb->len);
+		total_len = min_t(size_t, total_len, skb->len);
 		error = skb_copy_datagram_iovec(skb, 0, m->msg_iov, total_len);
 		if (error == 0)
 			error = total_len;
#3 lore raw
Quoted 5 lines · David Miller

From: Patrick McHardy <[email protected]>
Date: Tue, 24 Jun 2008 18:00:06 +0200

Quoted 2 lines

pppoe: fix compiler warning

Quoted 8 lines
Quoted 6 lines

Fix warning introduced by 392fdb0 (net pppoe: Check packet length on all receive paths):

drivers/net/pppoe.c: In function 'pppoe_recvmsg':
drivers/net/pppoe.c:945: warning: comparison of distinct pointer types lacks a cast

Should already be fixed in net-2.6 by:

My mistake, sorry :)