summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authoroster <oster@NetBSD.org>1999-01-14 20:29:38 +0000
committeroster <oster@NetBSD.org>1999-01-14 20:29:38 +0000
commit4128f9df1e0dac4363962a67ee836264b55e6077 (patch)
tree28305dd9ce6ad04b250f7a6fe5b607730f62d7f9 /sys/dev/raidframe
parenta6f7b8ff0e32b91ffa7427d10e03d94e2b2d1cd4 (diff)
Duh... check that malloc() hasn't returned a NULL *before* we zero the buffer,
not after. Pointed out by Michael Graff.
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_diskqueue.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/raidframe/rf_diskqueue.c b/sys/dev/raidframe/rf_diskqueue.c
index 65a6a3d6086..3a1e74cb8cb 100644
--- a/sys/dev/raidframe/rf_diskqueue.c
+++ b/sys/dev/raidframe/rf_diskqueue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_diskqueue.c,v 1.2 1998/12/03 14:58:24 oster Exp $ */
+/* $NetBSD: rf_diskqueue.c,v 1.3 1999/01/14 20:29:38 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -351,7 +351,6 @@ static int init_dqd(dqd)
#ifdef __NetBSD__
/* XXX not sure if the following malloc is appropriate... probably not quite... */
dqd->bp = (struct buf *) malloc( sizeof(struct buf), M_DEVBUF, M_NOWAIT);
- memset(dqd->bp,0,sizeof(struct buf)); /* if you don't do it, nobody else will.. */
/* XXX */
/* printf("NEED TO IMPLEMENT THIS BETTER!\n"); */
#else
@@ -360,6 +359,9 @@ static int init_dqd(dqd)
if (dqd->bp == NULL) {
return(ENOMEM);
}
+#ifdef __NetBSD__
+ memset(dqd->bp,0,sizeof(struct buf)); /* if you don't do it, nobody else will.. */
+#endif
#endif /* KERNEL */
return(0);
}