summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorThomas Nordin <nordin@cvs.openbsd.org>2002-01-10 00:06:18 +0000
committerThomas Nordin <nordin@cvs.openbsd.org>2002-01-10 00:06:18 +0000
commit634288c6fb708ac6b61b1742cec21ebc586cf1b2 (patch)
tree6f1fbc7a160b5deffed691801d3e7a0b26c94745 /sys/arch
parenta2ee845853e11a79fdd1e3ea97c337cfd23b0073 (diff)
Check result from malloc(9) when using M_NOWAIT. jason@ ok
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc/dev/obio.c6
-rw-r--r--sys/arch/sparc/dev/zs.c6
-rw-r--r--sys/arch/sparc64/dev/psycho.c4
-rw-r--r--sys/arch/sparc64/dev/sbus.c4
-rw-r--r--sys/arch/sparc64/sparc64/clock.c4
-rw-r--r--sys/arch/sparc64/sparc64/intr.c6
6 files changed, 24 insertions, 6 deletions
diff --git a/sys/arch/sparc/dev/obio.c b/sys/arch/sparc/dev/obio.c
index 5b0b22b5687..95d5f1d1abd 100644
--- a/sys/arch/sparc/dev/obio.c
+++ b/sys/arch/sparc/dev/obio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: obio.c,v 1.10 2001/12/08 02:24:07 art Exp $ */
+/* $OpenBSD: obio.c,v 1.11 2002/01/10 00:06:17 nordin Exp $ */
/* $NetBSD: obio.c,v 1.37 1997/07/29 09:58:11 fair Exp $ */
/*
@@ -302,6 +302,8 @@ vmesattach(parent, self, args)
if (vmeints == NULL) {
vmeints = (struct intrhand **)malloc(256 *
sizeof(struct intrhand *), M_TEMP, M_NOWAIT);
+ if (vmeints == NULL)
+ panic("vmesattach: can't allocate intrhand");
bzero(vmeints, 256 * sizeof(struct intrhand *));
}
(void)config_search(vmes_scan, self, args);
@@ -323,6 +325,8 @@ vmelattach(parent, self, args)
if (vmeints == NULL) {
vmeints = (struct intrhand **)malloc(256 *
sizeof(struct intrhand *), M_TEMP, M_NOWAIT);
+ if (vmeints == NULL)
+ panic("vmelattach: can't allocate intrhand");
bzero(vmeints, 256 * sizeof(struct intrhand *));
}
(void)config_search(vmel_scan, self, args);
diff --git a/sys/arch/sparc/dev/zs.c b/sys/arch/sparc/dev/zs.c
index d5fd19bb5b7..20d19d6c7d0 100644
--- a/sys/arch/sparc/dev/zs.c
+++ b/sys/arch/sparc/dev/zs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zs.c,v 1.29 2001/10/05 21:13:51 jason Exp $ */
+/* $OpenBSD: zs.c,v 1.30 2002/01/10 00:06:17 nordin Exp $ */
/* $NetBSD: zs.c,v 1.49 1997/08/31 21:26:37 pk Exp $ */
/*
@@ -353,6 +353,8 @@ zsattach(parent, dev, aux)
cs->cs_ringmask = ringsize - 1;
cs->cs_rbuf = malloc((u_long)ringsize * sizeof(*cs->cs_rbuf),
M_DEVBUF, M_NOWAIT);
+ if (cs->cs_rbuf == NULL)
+ panic("zsattach");
unit++;
cs++;
@@ -390,6 +392,8 @@ zsattach(parent, dev, aux)
cs->cs_ringmask = ringsize - 1;
cs->cs_rbuf = malloc((u_long)ringsize * sizeof(*cs->cs_rbuf),
M_DEVBUF, M_NOWAIT);
+ if (cs->cs_rbuf == NULL)
+ panic("zsattach");
}
#ifdef KGDB
diff --git a/sys/arch/sparc64/dev/psycho.c b/sys/arch/sparc64/dev/psycho.c
index 9436f9c63c1..f0f26564359 100644
--- a/sys/arch/sparc64/dev/psycho.c
+++ b/sys/arch/sparc64/dev/psycho.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: psycho.c,v 1.9 2001/12/14 14:55:57 jason Exp $ */
+/* $OpenBSD: psycho.c,v 1.10 2002/01/10 00:06:17 nordin Exp $ */
/* $NetBSD: psycho.c,v 1.39 2001/10/07 20:30:41 eeh Exp $ */
/*
@@ -522,6 +522,8 @@ psycho_set_intr(sc, ipl, handler, mapper, clearer)
ih = (struct intrhand *)malloc(sizeof(struct intrhand),
M_DEVBUF, M_NOWAIT);
+ if (ih == NULL)
+ panic("couldn't malloc intrhand");
ih->ih_arg = sc;
ih->ih_map = mapper;
ih->ih_clr = clearer;
diff --git a/sys/arch/sparc64/dev/sbus.c b/sys/arch/sparc64/dev/sbus.c
index 652c414b5bd..c9c776f0d84 100644
--- a/sys/arch/sparc64/dev/sbus.c
+++ b/sys/arch/sparc64/dev/sbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbus.c,v 1.8 2002/01/04 05:19:25 jason Exp $ */
+/* $OpenBSD: sbus.c,v 1.9 2002/01/10 00:06:17 nordin Exp $ */
/* $NetBSD: sbus.c,v 1.46 2001/10/07 20:30:41 eeh Exp $ */
/*-
@@ -337,6 +337,8 @@ sbus_attach(parent, self, aux)
/* Enable the over temp intr */
ih = (struct intrhand *)
malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT);
+ if (ih == NULL)
+ panic("couldn't malloc intrhand");
ih->ih_map = &sc->sc_sysio->therm_int_map;
ih->ih_clr = NULL; /* &sc->sc_sysio->therm_clr_int; */
ih->ih_fun = sbus_overtemp;
diff --git a/sys/arch/sparc64/sparc64/clock.c b/sys/arch/sparc64/sparc64/clock.c
index c3c4b9f8da9..c96ae8cdbb7 100644
--- a/sys/arch/sparc64/sparc64/clock.c
+++ b/sys/arch/sparc64/sparc64/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.6 2001/12/07 19:09:00 jason Exp $ */
+/* $OpenBSD: clock.c,v 1.7 2002/01/10 00:06:17 nordin Exp $ */
/* $NetBSD: clock.c,v 1.41 2001/07/24 19:29:25 eeh Exp $ */
/*
@@ -511,6 +511,8 @@ clockattach_rtc(parent, self, aux)
/* Setup our todr_handle */
sz = ALIGN(sizeof(struct todr_chip_handle)) + sizeof(struct rtc_info);
handle = malloc(sz, M_DEVBUF, M_NOWAIT);
+ if (handle == NULL)
+ panic("clockattach_rtc");
rtc = (struct rtc_info*)((u_long)handle +
ALIGN(sizeof(struct todr_chip_handle)));
handle->cookie = rtc;
diff --git a/sys/arch/sparc64/sparc64/intr.c b/sys/arch/sparc64/sparc64/intr.c
index 5f188196ed5..b245ec08c12 100644
--- a/sys/arch/sparc64/sparc64/intr.c
+++ b/sys/arch/sparc64/sparc64/intr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.6 2001/11/28 05:32:11 jason Exp $ */
+/* $OpenBSD: intr.c,v 1.7 2002/01/10 00:06:17 nordin Exp $ */
/* $NetBSD: intr.c,v 1.39 2001/07/19 23:38:11 eeh Exp $ */
/*
@@ -282,6 +282,8 @@ intr_establish(level, ih)
if (q->ih_fun != intr_list_handler) {
nih = (struct intrhand *)malloc(sizeof(struct intrhand),
M_DEVBUF, M_NOWAIT);
+ if (nih == NULL)
+ panic("intr_establish");
/* Point the old IH at the new handler */
*nih = *q;
q->ih_fun = intr_list_handler;
@@ -290,6 +292,8 @@ intr_establish(level, ih)
}
nih = (struct intrhand *)malloc(sizeof(struct intrhand),
M_DEVBUF, M_NOWAIT);
+ if (nih == NULL)
+ panic("intr_establish");
*nih = *ih;
/* Add the ih to the head of the list */
nih->ih_next = (struct intrhand *)q->ih_arg;