Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nick-nhusb]: src/sys/dev/usb Be more careful about malloc returning NULL
details: https://anonhg.NetBSD.org/src/rev/2cc773b594f2
branches: nick-nhusb
changeset: 334628:2cc773b594f2
user: skrll <skrll%NetBSD.org@localhost>
date: Wed Feb 01 07:55:08 2017 +0000
description:
Be more careful about malloc returning NULL
diffstat:
sys/dev/usb/if_otus.c | 6 +++---
sys/dev/usb/if_zyd.c | 7 +++----
2 files changed, 6 insertions(+), 7 deletions(-)
diffs (56 lines):
diff -r 98f291331ad9 -r 2cc773b594f2 sys/dev/usb/if_otus.c
--- a/sys/dev/usb/if_otus.c Tue Jan 31 17:09:08 2017 +0000
+++ b/sys/dev/usb/if_otus.c Wed Feb 01 07:55:08 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_otus.c,v 1.25.6.9 2016/12/05 10:55:18 skrll Exp $ */
+/* $NetBSD: if_otus.c,v 1.25.6.10 2017/02/01 07:55:08 skrll Exp $ */
/* $OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $ */
/*-
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.25.6.9 2016/12/05 10:55:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.25.6.10 2017/02/01 07:55:08 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1493,7 +1493,7 @@
DPRINTFN(DBG_FN, DBG_NO_SC, "\n");
on = malloc(sizeof(*on), M_DEVBUF, M_NOWAIT | M_ZERO);
- return &on->ni;
+ return on ? &on->ni : NULL;
}
Static int
diff -r 98f291331ad9 -r 2cc773b594f2 sys/dev/usb/if_zyd.c
--- a/sys/dev/usb/if_zyd.c Tue Jan 31 17:09:08 2017 +0000
+++ b/sys/dev/usb/if_zyd.c Wed Feb 01 07:55:08 2017 +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.36.14.13 2017/01/28 12:12:19 skrll Exp $ */
+/* $NetBSD: if_zyd.c,v 1.36.14.14 2017/02/01 07:55:08 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.36.14.13 2017/01/28 12:12:19 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.36.14.14 2017/02/01 07:55:08 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -672,8 +672,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