Re: udp.c

From: Herbert Xu
Date: Mon Jun 13 2005 - 19:21:16 EST


David S. Miller <davem@xxxxxxxxxxxxx> wrote:
> From: Jesper Juhl <jesper.juhl@xxxxxxxxx>
> Date: Mon, 13 Jun 2005 19:23:36 +0200
>
>> Why not remove the function and audit the code for users (and if any,
>> remove them)...? Let's get rid of it instead of having a function sit
>> around the only purpose of which is to BUG();
>
> Then if someone breaks that invariant, we'll never find out.
>
> The code is staying, sorry.

It'll dump the stack anyway if we just make it a NULL pointer.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -201,11 +201,6 @@ fail:
return 1;
}

-static void udp_v4_hash(struct sock *sk)
-{
- BUG();
-}
-
static void udp_v4_unhash(struct sock *sk)
{
write_lock_bh(&udp_hash_lock);
@@ -1370,7 +1365,7 @@ struct proto udp_prot = {
.recvmsg = udp_recvmsg,
.sendpage = udp_sendpage,
.backlog_rcv = udp_queue_rcv_skb,
- .hash = udp_v4_hash,
+ /* .hash is intentionally left NULL */
.unhash = udp_v4_unhash,
.get_port = udp_v4_get_port,
.obj_size = sizeof(struct udp_sock),
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -135,11 +135,6 @@ fail:
return 1;
}

-static void udp_v6_hash(struct sock *sk)
-{
- BUG();
-}
-
static void udp_v6_unhash(struct sock *sk)
{
write_lock_bh(&udp_hash_lock);
@@ -1048,7 +1043,7 @@ struct proto udpv6_prot = {
.sendmsg = udpv6_sendmsg,
.recvmsg = udpv6_recvmsg,
.backlog_rcv = udpv6_queue_rcv_skb,
- .hash = udp_v6_hash,
+ /* .hash is intentionally left NULL */
.unhash = udp_v6_unhash,
.get_port = udp_v6_get_port,
.obj_size = sizeof(struct udp6_sock),
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/