Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb If malloc fails in zyd_node_alloc then return NU...



details:   https://anonhg.NetBSD.org/src/rev/8659ced13df5
branches:  trunk
changeset: 467145:8659ced13df5
user:      skrll <skrll%NetBSD.org@localhost>
date:      Wed Jan 15 08:21:00 2020 +0000

description:
If malloc fails in zyd_node_alloc then return NULL.  From nick-nhusb

diffstat:

 sys/dev/usb/if_zyd.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 473974a67946 -r 8659ced13df5 sys/dev/usb/if_zyd.c
--- a/sys/dev/usb/if_zyd.c      Wed Jan 15 08:20:13 2020 +0000
+++ b/sys/dev/usb/if_zyd.c      Wed Jan 15 08:21:00 2020 +0000
@@ -1,5 +1,5 @@
 /*     $OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $ */
-/*     $NetBSD: if_zyd.c,v 1.54 2020/01/15 08:20:13 skrll Exp $        */
+/*     $NetBSD: if_zyd.c,v 1.55 2020/01/15 08:21:00 skrll Exp $        */
 
 /*-
  * Copyright (c) 2006 by Damien Bergamini <damien.bergamini%free.fr@localhost>
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.54 2020/01/15 08:20:13 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.55 2020/01/15 08:21:00 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -662,8 +662,7 @@
        struct zyd_node *zn;
 
        zn = malloc(sizeof(struct zyd_node), M_80211_NODE, M_NOWAIT | M_ZERO);
-
-       return &zn->ni;
+       return zn ? &zn->ni : NULL;
 }
 
 Static int



Home | Main Index | Thread Index | Old Index