inet_diag: Remove indirect sizeof from inet diag handlers
authorPavel Emelyanov <xemul@parallels.com>
Fri, 9 Dec 2011 06:21:16 +0000 (06:21 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Dec 2011 19:14:07 +0000 (14:14 -0500)
There's an info_size value stored on inet_diag_handler, but for existing
code this value is effectively constant, so just use sizeof(struct tcp_info)
where required.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/inet_diag.h
net/dccp/diag.c
net/ipv4/inet_diag.c
net/ipv4/tcp_diag.c

index defe8ff36df8c5c81dee1e4c69a8ccc8dfef0015..851feff0747f039e7b535f6f76595f61db9b5dd9 100644 (file)
@@ -141,7 +141,6 @@ struct inet_diag_handler {
        void                    (*idiag_get_info)(struct sock *sk,
                                                  struct inet_diag_msg *r,
                                                  void *info);
-       __u16                   idiag_info_size;
        __u16                   idiag_type;
 };
 
index 424dcd8415d74e3b7f7b18c4d79a4f7363d7c2b6..9343f52db284a4e791376756d95dcabd5fc3f91c 100644 (file)
@@ -52,7 +52,6 @@ static const struct inet_diag_handler dccp_diag_handler = {
        .idiag_hashinfo  = &dccp_hashinfo,
        .idiag_get_info  = dccp_diag_get_info,
        .idiag_type      = IPPROTO_DCCP,
-       .idiag_info_size = sizeof(struct tcp_info),
 };
 
 static int __init dccp_diag_init(void)
index b56b7ba8beeb40b9dadd6f7e0c2ffcf7d6da930f..a247f85571c4b5b1ceac41538ab4ccdc73954004 100644 (file)
@@ -98,8 +98,7 @@ static int inet_csk_diag_fill(struct sock *sk,
                minfo = INET_DIAG_PUT(skb, INET_DIAG_MEMINFO, sizeof(*minfo));
 
        if (ext & (1 << (INET_DIAG_INFO - 1)))
-               info = INET_DIAG_PUT(skb, INET_DIAG_INFO,
-                                    handler->idiag_info_size);
+               info = INET_DIAG_PUT(skb, INET_DIAG_INFO, sizeof(struct tcp_info));
 
        if ((ext & (1 << (INET_DIAG_CONG - 1))) && icsk->icsk_ca_ops) {
                const size_t len = strlen(icsk->icsk_ca_ops->name);
@@ -299,7 +298,7 @@ static int inet_diag_get_exact(struct sk_buff *in_skb,
        err = -ENOMEM;
        rep = alloc_skb(NLMSG_SPACE((sizeof(struct inet_diag_msg) +
                                     sizeof(struct inet_diag_meminfo) +
-                                    handler->idiag_info_size + 64)),
+                                    sizeof(struct tcp_info) + 64)),
                        GFP_KERNEL);
        if (!rep)
                goto out;
index 981497795d49746bd1b40a1c5a3cc8023dc4fbb8..42e6bec7bd3ee19b4147906386d386241df25bfa 100644 (file)
@@ -38,7 +38,6 @@ static const struct inet_diag_handler tcp_diag_handler = {
        .idiag_hashinfo  = &tcp_hashinfo,
        .idiag_get_info  = tcp_diag_get_info,
        .idiag_type      = IPPROTO_TCP,
-       .idiag_info_size = sizeof(struct tcp_info),
 };
 
 static int __init tcp_diag_init(void)