Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/qbus Fix a erroneous malloc.
details: https://anonhg.NetBSD.org/src/rev/966236d9a19a
branches: trunk
changeset: 473885:966236d9a19a
user: ragge <ragge%NetBSD.org@localhost>
date: Sun Jun 20 17:56:29 1999 +0000
description:
Fix a erroneous malloc.
diffstat:
sys/dev/qbus/uba.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diffs (35 lines):
diff -r a15716ae324b -r 966236d9a19a sys/dev/qbus/uba.c
--- a/sys/dev/qbus/uba.c Sun Jun 20 17:55:12 1999 +0000
+++ b/sys/dev/qbus/uba.c Sun Jun 20 17:56:29 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uba.c,v 1.47 1999/06/06 19:14:49 ragge Exp $ */
+/* $NetBSD: uba.c,v 1.48 1999/06/20 17:56:29 ragge Exp $ */
/*
* Copyright (c) 1996 Jonathan Stone.
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
@@ -201,17 +201,19 @@
scb_vecalloc(vec, ua.ua_ivec, cf->cf_unit, SCB_ISTACK);
if (ua.ua_reset) { /* device wants ubareset */
if (sc->uh_resno == 0) {
- sc->uh_reset = malloc(sizeof(ua.ua_reset),
+#define RESETSIXE 128
+ sc->uh_reset = malloc(sizeof(void *) * RESETSIXE,
+ M_DEVBUF, M_NOWAIT);
+ sc->uh_resarg = malloc(sizeof(void *) * RESETSIXE,
M_DEVBUF, M_NOWAIT);
- sc->uh_resarg = (int *)sc->uh_reset + 128;
}
- if (sc->uh_resno > 127) {
+ if (sc->uh_resno < RESETSIXE) {
+ sc->uh_resarg[sc->uh_resno] = cf->cf_unit;
+ sc->uh_reset[sc->uh_resno++] = ua.ua_reset;
+ } else {
printf("%s: Expand reset table, skipping reset %s%d\n",
sc->uh_dev.dv_xname, cf->cf_driver->cd_name,
cf->cf_unit);
- } else {
- sc->uh_resarg[sc->uh_resno] = cf->cf_unit;
- sc->uh_reset[sc->uh_resno++] = ua.ua_reset;
}
}
ua.ua_br = br;
Home |
Main Index |
Thread Index |
Old Index