Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net kmem_alloc(size, KM_SLEEP) return value NULL check i...



details:   https://anonhg.NetBSD.org/src/rev/92837ea85ae5
branches:  trunk
changeset: 347749:92837ea85ae5
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Thu Sep 15 06:59:32 2016 +0000

description:
kmem_alloc(size, KM_SLEEP) return value NULL check is not required any more.

kmem_alloc(size, KM_SLEEP) is already fixed, that is, it never return NULL.
see: sys/kern/subr_kmem.c:r1.62

diffstat:

 sys/net/if_gif.c |  15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diffs (36 lines):

diff -r 0f4d67323fa0 -r 92837ea85ae5 sys/net/if_gif.c
--- a/sys/net/if_gif.c  Wed Sep 14 23:16:30 2016 +0000
+++ b/sys/net/if_gif.c  Thu Sep 15 06:59:32 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_gif.c,v 1.122 2016/09/01 06:50:09 knakahara Exp $   */
+/*     $NetBSD: if_gif.c,v 1.123 2016/09/15 06:59:32 knakahara Exp $   */
 /*     $KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $    */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.122 2016/09/01 06:50:09 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.123 2016/09/15 06:59:32 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -991,15 +991,8 @@
                /* XXX both end must be valid? (I mean, not 0.0.0.0) */
        }
 
-       if ((nsrc = sockaddr_dup(src, M_WAITOK)) == NULL) {
-               error =  ENOMEM;
-               goto out;
-       }
-       if ((ndst = sockaddr_dup(dst, M_WAITOK)) == NULL) {
-               sockaddr_free(nsrc);
-               error = ENOMEM;
-               goto out;
-       }
+       nsrc = sockaddr_dup(src, M_WAITOK);
+       ndst = sockaddr_dup(dst, M_WAITOK);
 
        gif_encap_pause(sc);
 



Home | Main Index | Thread Index | Old Index