summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornordin <nordin@openbsd.org>2002-01-10 00:11:14 +0000
committernordin <nordin@openbsd.org>2002-01-10 00:11:14 +0000
commit8c8d41eb526e72873dab7adc9f4d6ed6985470fd (patch)
treef99d6247c324f54d163f2e7801a80bf0f612bf89
parentCheck result from malloc(9) when using M_NOWAIT. jason@ ok (diff)
downloadwireguard-openbsd-8c8d41eb526e72873dab7adc9f4d6ed6985470fd.tar.xz
wireguard-openbsd-8c8d41eb526e72873dab7adc9f4d6ed6985470fd.zip
Check result from malloc(9) when using M_NOWAIT. hugh@ ok
-rw-r--r--sys/arch/vax/dec/dzkbd.c4
-rw-r--r--sys/arch/vax/mscp/mscp.c4
-rw-r--r--sys/arch/vax/qbus/uba.c4
-rw-r--r--sys/arch/vax/uba/uba.c6
4 files changed, 14 insertions, 4 deletions
diff --git a/sys/arch/vax/dec/dzkbd.c b/sys/arch/vax/dec/dzkbd.c
index b96949d9848..2670dcc39fd 100644
--- a/sys/arch/vax/dec/dzkbd.c
+++ b/sys/arch/vax/dec/dzkbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dzkbd.c,v 1.1 2001/05/16 22:15:17 hugh Exp $ */
+/* $OpenBSD: dzkbd.c,v 1.2 2002/01/10 00:11:14 nordin Exp $ */
/* $NetBSD: dzkbd.c,v 1.1 2000/12/02 17:03:55 ragge Exp $ */
/*
@@ -175,6 +175,8 @@ dzkbd_attach(struct device *parent, struct device *self, void *aux)
} else {
dzi = malloc(sizeof(struct dzkbd_internal),
M_DEVBUF, M_NOWAIT);
+ if (dzi == NULL)
+ panic("dzkbd_attach");
dzi->dzi_ks.attmt.sendchar = dzkbd_sendchar;
dzi->dzi_ks.attmt.cookie = ls;
dzi->dzi_ls = ls;
diff --git a/sys/arch/vax/mscp/mscp.c b/sys/arch/vax/mscp/mscp.c
index bcee44f0463..e7ad265ae51 100644
--- a/sys/arch/vax/mscp/mscp.c
+++ b/sys/arch/vax/mscp/mscp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mscp.c,v 1.6 2001/12/05 03:04:38 hugh Exp $ */
+/* $OpenBSD: mscp.c,v 1.7 2002/01/10 00:11:14 nordin Exp $ */
/* $NetBSD: mscp.c,v 1.16 2001/11/13 07:38:28 lukem Exp $ */
/*
@@ -186,6 +186,8 @@ loop:
int tmpno = ((mp->mscp_unit + 32) & 0xffe0) * sizeof(void *);
struct device **tmp = (struct device **)
malloc(tmpno, M_DEVBUF, M_NOWAIT);
+ if (tmp == NULL)
+ panic("mscp_dorsp");
bzero(tmp, tmpno);
if (mi->mi_driveno) {
bcopy(mi->mi_dp, tmp, mi->mi_driveno);
diff --git a/sys/arch/vax/qbus/uba.c b/sys/arch/vax/qbus/uba.c
index 79784d246c9..7edd1b5ea81 100644
--- a/sys/arch/vax/qbus/uba.c
+++ b/sys/arch/vax/qbus/uba.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uba.c,v 1.4 2001/11/06 19:53:17 miod Exp $ */
+/* $OpenBSD: uba.c,v 1.5 2002/01/10 00:11:14 nordin Exp $ */
/* $NetBSD: uba.c,v 1.52 2000/06/04 02:14:12 matt Exp $ */
/*
* Copyright (c) 1996 Jonathan Stone.
@@ -117,6 +117,8 @@ uba_reset_establish(void (*reset)(struct device *), struct device *dev)
struct uba_reset *ur;
ur = malloc(sizeof(struct uba_reset), M_DEVBUF, M_NOWAIT);
+ if (ur == NULL)
+ panic("uba_reset_establish");
ur->ur_dev = dev;
ur->ur_reset = reset;
diff --git a/sys/arch/vax/uba/uba.c b/sys/arch/vax/uba/uba.c
index 81d36cd2485..491a5f3b58e 100644
--- a/sys/arch/vax/uba/uba.c
+++ b/sys/arch/vax/uba/uba.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uba.c,v 1.12 2001/11/06 19:53:17 miod Exp $ */
+/* $OpenBSD: uba.c,v 1.13 2002/01/10 00:11:14 nordin Exp $ */
/* $NetBSD: uba.c,v 1.43 2000/01/24 02:40:36 matt Exp $ */
/*
* Copyright (c) 1996 Jonathan Stone.
@@ -814,6 +814,8 @@ uba_attach(sc, iopagephys)
*/
sc->uh_map = (struct map *)malloc((u_long)
(UAMSIZ * sizeof(struct map)), M_DEVBUF, M_NOWAIT);
+ if (sc->uh_map == NULL)
+ panic("uba_attach");
bzero((caddr_t)sc->uh_map, (unsigned)(UAMSIZ * sizeof (struct map)));
ubainitmaps(sc);
@@ -869,6 +871,8 @@ ubasearch(parent, cf, aux)
if (ua.ua_reset) { /* device wants ubareset */
if (sc->uh_resno == 0) {
sc->uh_reset = malloc(1024, M_DEVBUF, M_NOWAIT);
+ if (sc->uh_reset == NULL)
+ panic("ubasearch");
sc->uh_resarg = (int *)sc->uh_reset + 128;
}
#ifdef DIAGNOSTIC