[TCP] minisocks: Use kmemdup and LIMIT_NETDEBUG

Code diff stats:

[acme@newtoy net-2.6.20]$ codiff /tmp/tcp_minisocks.o.before /tmp/tcp_minisocks.o.after
/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/tcp_minisocks.c:
  tcp_check_req |  -44
 1 function changed, 44 bytes removed
[acme@newtoy net-2.6.20]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2006-11-17 11:25:49 -02:00 committed by David S. Miller
parent 42e5ea466c
commit c67862403e

View file

@ -351,8 +351,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
* socket up. We've got bigger problems than * socket up. We've got bigger problems than
* non-graceful socket closings. * non-graceful socket closings.
*/ */
if (net_ratelimit()) LIMIT_NETDEBUG(KERN_INFO "TCP: time wait bucket table overflow\n");
printk(KERN_INFO "TCP: time wait bucket table overflow\n");
} }
tcp_update_metrics(sk); tcp_update_metrics(sk);
@ -667,11 +666,11 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
* newsk structure. If we fail to get memory then we * newsk structure. If we fail to get memory then we
* end up not copying the key across. Shucks. * end up not copying the key across. Shucks.
*/ */
char *newkey = kmalloc(key->keylen, GFP_ATOMIC); char *newkey = kmemdup(key->key, key->keylen,
GFP_ATOMIC);
if (newkey) { if (newkey) {
if (!tcp_alloc_md5sig_pool()) if (!tcp_alloc_md5sig_pool())
BUG(); BUG();
memcpy(newkey, key->key, key->keylen);
tp->af_specific->md5_add(child, child, tp->af_specific->md5_add(child, child,
newkey, newkey,
key->keylen); key->keylen);