]> err.no Git - linux-2.6/blobdiff - net/rxrpc/transport.c
Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
[linux-2.6] / net / rxrpc / transport.c
index dbe6105e83a54e1f9ce66b4466a2863e0d7f155f..8e57be2df93625867d470eb5185fe22114ec513d 100644 (file)
@@ -9,7 +9,6 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <rxrpc/transport.h>
@@ -31,7 +30,6 @@
 #endif
 #include <linux/errqueue.h>
 #include <asm/uaccess.h>
-#include <asm/checksum.h>
 #include "internal.h"
 
 struct errormsg {
@@ -68,11 +66,10 @@ int rxrpc_create_transport(unsigned short port,
 
        _enter("%hu", port);
 
-       trans = kmalloc(sizeof(struct rxrpc_transport), GFP_KERNEL);
+       trans = kzalloc(sizeof(struct rxrpc_transport), GFP_KERNEL);
        if (!trans)
                return -ENOMEM;
 
-       memset(trans, 0, sizeof(struct rxrpc_transport));
        atomic_set(&trans->usage, 1);
        INIT_LIST_HEAD(&trans->services);
        INIT_LIST_HEAD(&trans->link);
@@ -312,13 +309,12 @@ static int rxrpc_incoming_msg(struct rxrpc_transport *trans,
 
        _enter("");
 
-       msg = kmalloc(sizeof(struct rxrpc_message), GFP_KERNEL);
+       msg = kzalloc(sizeof(struct rxrpc_message), GFP_KERNEL);
        if (!msg) {
                _leave(" = -ENOMEM");
                return -ENOMEM;
        }
 
-       memset(msg, 0, sizeof(*msg));
        atomic_set(&msg->usage, 1);
        list_add_tail(&msg->link,msgq);
 
@@ -333,10 +329,10 @@ static int rxrpc_incoming_msg(struct rxrpc_transport *trans,
        msg->state = RXRPC_MSG_RECEIVED;
        skb_get_timestamp(pkt, &msg->stamp);
        if (msg->stamp.tv_sec == 0) {
-               do_gettimeofday(&msg->stamp); 
-               if (pkt->sk) 
+               do_gettimeofday(&msg->stamp);
+               if (pkt->sk)
                        sock_enable_timestamp(pkt->sk);
-       } 
+       }
        msg->seq = ntohl(msg->hdr.seq);
 
        /* attach the packet */
@@ -383,11 +379,10 @@ static int rxrpc_incoming_msg(struct rxrpc_transport *trans,
 
                /* allocate a new message record */
                ret = -ENOMEM;
-               msg = kmalloc(sizeof(struct rxrpc_message), GFP_KERNEL);
+               msg = kmemdup(jumbomsg, sizeof(struct rxrpc_message), GFP_KERNEL);
                if (!msg)
                        goto error;
 
-               memcpy(msg, jumbomsg, sizeof(*msg));
                list_add_tail(&msg->link, msgq);
 
                /* adjust the jumbo packet */