ChangeSet 1.2217.1.21, 2005/03/17 10:31:09-08:00, [EMAIL PROTECTED]

        [NET]: Save space for sk_alloc_slab() failure message.
        
        Signed-off-by: Hideaki YOSHIFUJI <[EMAIL PROTECTED]>
        Signed-off-by: David S. Miller <[EMAIL PROTECTED]>



 include/net/sock.h  |    5 -----
 net/core/sock.c     |    8 +++++++-
 net/ipv4/af_inet.c  |   14 +++++---------
 net/ipv6/af_inet6.c |   15 ++++++---------
 4 files changed, 18 insertions(+), 24 deletions(-)


diff -Nru a/include/net/sock.h b/include/net/sock.h
--- a/include/net/sock.h        2005-03-18 14:07:37 -08:00
+++ b/include/net/sock.h        2005-03-18 14:07:37 -08:00
@@ -561,11 +561,6 @@
 extern int sk_alloc_slab(struct proto *prot, char *name);
 extern void sk_free_slab(struct proto *prot);
 
-static inline void sk_alloc_slab_error(struct proto *proto)
-{
-       printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n", proto->name);
-}
-
 static __inline__ void sk_set_owner(struct sock *sk, struct module *owner)
 {
        /*
diff -Nru a/net/core/sock.c b/net/core/sock.c
--- a/net/core/sock.c   2005-03-18 14:07:37 -08:00
+++ b/net/core/sock.c   2005-03-18 14:07:37 -08:00
@@ -1374,7 +1374,13 @@
                                       prot->slab_obj_size, 0,
                                       SLAB_HWCACHE_ALIGN, NULL, NULL);
 
-       return prot->slab != NULL ? 0 : -ENOBUFS;
+       if (prot->slab == NULL) {
+               printk(KERN_CRIT "%s: Can't create sock SLAB cache!\n",
+                      prot->name);
+               return -ENOBUFS;
+       }
+
+       return 0;
 }
 
 EXPORT_SYMBOL(sk_alloc_slab);
diff -Nru a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
--- a/net/ipv4/af_inet.c        2005-03-18 14:07:37 -08:00
+++ b/net/ipv4/af_inet.c        2005-03-18 14:07:37 -08:00
@@ -1027,20 +1027,16 @@
        }
 
        rc = sk_alloc_slab(&tcp_prot, "tcp_sock");
-       if (rc) {
-               sk_alloc_slab_error(&tcp_prot);
+       if (rc)
                goto out;
-       }
+
        rc = sk_alloc_slab(&udp_prot, "udp_sock");
-       if (rc) {
-               sk_alloc_slab_error(&udp_prot);
+       if (rc)
                goto out_tcp_free_slab;
-       }
+
        rc = sk_alloc_slab(&raw_prot, "raw_sock");
-       if (rc) {
-               sk_alloc_slab_error(&raw_prot);
+       if (rc)
                goto out_udp_free_slab;
-       }
 
        /*
         *      Tell SOCKET that we are alive... 
diff -Nru a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
--- a/net/ipv6/af_inet6.c       2005-03-18 14:07:37 -08:00
+++ b/net/ipv6/af_inet6.c       2005-03-18 14:07:37 -08:00
@@ -711,20 +711,17 @@
        }
 
        err = sk_alloc_slab(&tcpv6_prot, "tcpv6_sock");
-       if (err) {
-               sk_alloc_slab_error(&tcpv6_prot);
+       if (err)
                goto out;
-       }
+
        err = sk_alloc_slab(&udpv6_prot, "udpv6_sock");
-       if (err) {
-               sk_alloc_slab_error(&udpv6_prot);
+       if (err)
                goto out_tcp_free_slab;
-       }
+
        err = sk_alloc_slab(&rawv6_prot, "rawv6_sock");
-       if (err) {
-               sk_alloc_slab_error(&rawv6_prot);
+       if (err)
                goto out_udp_free_slab;
-       }
+
 
        /* Register the socket-side information for inet6_create.  */
        for(r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r)
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to