diff options
Diffstat (limited to 'net/core/sock.c')
| -rw-r--r-- | net/core/sock.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 305cba401ae6..fcd397a762ff 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
| @@ -741,7 +741,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname, | |||
| 741 | struct timeval tm; | 741 | struct timeval tm; |
| 742 | } v; | 742 | } v; |
| 743 | 743 | ||
| 744 | unsigned int lv = sizeof(int); | 744 | int lv = sizeof(int); |
| 745 | int len; | 745 | int len; |
| 746 | 746 | ||
| 747 | if (get_user(len, optlen)) | 747 | if (get_user(len, optlen)) |
| @@ -2141,13 +2141,13 @@ int sock_prot_inuse_get(struct net *net, struct proto *prot) | |||
| 2141 | } | 2141 | } |
| 2142 | EXPORT_SYMBOL_GPL(sock_prot_inuse_get); | 2142 | EXPORT_SYMBOL_GPL(sock_prot_inuse_get); |
| 2143 | 2143 | ||
| 2144 | static int sock_inuse_init_net(struct net *net) | 2144 | static int __net_init sock_inuse_init_net(struct net *net) |
| 2145 | { | 2145 | { |
| 2146 | net->core.inuse = alloc_percpu(struct prot_inuse); | 2146 | net->core.inuse = alloc_percpu(struct prot_inuse); |
| 2147 | return net->core.inuse ? 0 : -ENOMEM; | 2147 | return net->core.inuse ? 0 : -ENOMEM; |
| 2148 | } | 2148 | } |
| 2149 | 2149 | ||
| 2150 | static void sock_inuse_exit_net(struct net *net) | 2150 | static void __net_exit sock_inuse_exit_net(struct net *net) |
| 2151 | { | 2151 | { |
| 2152 | free_percpu(net->core.inuse); | 2152 | free_percpu(net->core.inuse); |
| 2153 | } | 2153 | } |
| @@ -2229,13 +2229,10 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
| 2229 | } | 2229 | } |
| 2230 | 2230 | ||
| 2231 | if (prot->rsk_prot != NULL) { | 2231 | if (prot->rsk_prot != NULL) { |
| 2232 | static const char mask[] = "request_sock_%s"; | 2232 | prot->rsk_prot->slab_name = kasprintf(GFP_KERNEL, "request_sock_%s", prot->name); |
| 2233 | |||
| 2234 | prot->rsk_prot->slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL); | ||
| 2235 | if (prot->rsk_prot->slab_name == NULL) | 2233 | if (prot->rsk_prot->slab_name == NULL) |
| 2236 | goto out_free_sock_slab; | 2234 | goto out_free_sock_slab; |
| 2237 | 2235 | ||
| 2238 | sprintf(prot->rsk_prot->slab_name, mask, prot->name); | ||
| 2239 | prot->rsk_prot->slab = kmem_cache_create(prot->rsk_prot->slab_name, | 2236 | prot->rsk_prot->slab = kmem_cache_create(prot->rsk_prot->slab_name, |
| 2240 | prot->rsk_prot->obj_size, 0, | 2237 | prot->rsk_prot->obj_size, 0, |
| 2241 | SLAB_HWCACHE_ALIGN, NULL); | 2238 | SLAB_HWCACHE_ALIGN, NULL); |
| @@ -2248,14 +2245,11 @@ int proto_register(struct proto *prot, int alloc_slab) | |||
| 2248 | } | 2245 | } |
| 2249 | 2246 | ||
| 2250 | if (prot->twsk_prot != NULL) { | 2247 | if (prot->twsk_prot != NULL) { |
| 2251 | static const char mask[] = "tw_sock_%s"; | 2248 | prot->twsk_prot->twsk_slab_name = kasprintf(GFP_KERNEL, "tw_sock_%s", prot->name); |
| 2252 | |||
| 2253 | prot->twsk_prot->twsk_slab_name = kmalloc(strlen(prot->name) + sizeof(mask) - 1, GFP_KERNEL); | ||
| 2254 | 2249 | ||
| 2255 | if (prot->twsk_prot->twsk_slab_name == NULL) | 2250 | if (prot->twsk_prot->twsk_slab_name == NULL) |
| 2256 | goto out_free_request_sock_slab; | 2251 | goto out_free_request_sock_slab; |
| 2257 | 2252 | ||
| 2258 | sprintf(prot->twsk_prot->twsk_slab_name, mask, prot->name); | ||
| 2259 | prot->twsk_prot->twsk_slab = | 2253 | prot->twsk_prot->twsk_slab = |
| 2260 | kmem_cache_create(prot->twsk_prot->twsk_slab_name, | 2254 | kmem_cache_create(prot->twsk_prot->twsk_slab_name, |
| 2261 | prot->twsk_prot->twsk_obj_size, | 2255 | prot->twsk_prot->twsk_obj_size, |
