summaryrefslogtreecommitdiffstats
path: root/sys/dev/aac/aac.c
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2003-06-03 02:10:55 +0000
committerscottl <scottl@FreeBSD.org>2003-06-03 02:10:55 +0000
commitbf60ecbfb2d83cf558792c69ac18ac88f921df71 (patch)
tree39ef3df1b37931b79e3180b78d8deb6c449a1add /sys/dev/aac/aac.c
parentcd6f53b88d305e5e531a2edbd0c1ebac23b7650d (diff)
downloadFreeBSD-src-bf60ecbfb2d83cf558792c69ac18ac88f921df71.zip
FreeBSD-src-bf60ecbfb2d83cf558792c69ac18ac88f921df71.tar.gz
When scanning for changed containers, don't assume that the controller
will respond in a sane manner. Thanks to Petri Helenius <pete@he.iki.fi> for spotting this and pestering me to fix it.
Diffstat (limited to 'sys/dev/aac/aac.c')
-rw-r--r--sys/dev/aac/aac.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c
index 69ad8bc..21935a8 100644
--- a/sys/dev/aac/aac.c
+++ b/sys/dev/aac/aac.c
@@ -306,7 +306,7 @@ aac_startup(void *arg)
struct aac_fib *fib;
struct aac_mntinfo *mi;
struct aac_mntinforesp *mir = NULL;
- int i = 0;
+ int count = 0, i = 0;
debug_called(1);
@@ -327,14 +327,16 @@ aac_startup(void *arg)
mi->MntCount = i;
if (aac_sync_fib(sc, ContainerCommand, 0, fib,
sizeof(struct aac_mntinfo))) {
- debug(2, "error probing container %d", i);
+ printf("error probing container %d", i);
continue;
}
mir = (struct aac_mntinforesp *)&fib->data[0];
+ /* XXX Need to check if count changed */
+ count = mir->MntRespCount;
aac_add_container(sc, mir, 0);
i++;
- } while ((i < mir->MntRespCount) && (i < AAC_MAX_CONTAINERS));
+ } while ((i < count) && (i < AAC_MAX_CONTAINERS));
aac_release_sync_fib(sc);
@@ -2565,7 +2567,7 @@ aac_handle_aif(struct aac_softc *sc, struct aac_fib *fib)
struct aac_mntinforesp *mir = NULL;
u_int16_t rsize;
int next, found;
- int added = 0, i = 0;
+ int count = 0, added = 0, i = 0;
debug_called(2);
@@ -2600,11 +2602,13 @@ aac_handle_aif(struct aac_softc *sc, struct aac_fib *fib)
rsize = sizeof(mir);
if (aac_sync_fib(sc, ContainerCommand, 0, fib,
sizeof(struct aac_mntinfo))) {
- debug(2, "Error probing container %d\n",
+ printf("Error probing container %d\n",
i);
continue;
}
mir = (struct aac_mntinforesp *)&fib->data[0];
+ /* XXX Need to check if count changed */
+ count = mir->MntRespCount;
/*
* Check the container against our list.
* co->co_found was already set to 0 in a
@@ -2640,8 +2644,7 @@ aac_handle_aif(struct aac_softc *sc, struct aac_fib *fib)
added = 1;
}
i++;
- } while ((i < mir->MntRespCount) &&
- (i < AAC_MAX_CONTAINERS));
+ } while ((i < count) && (i < AAC_MAX_CONTAINERS));
aac_release_sync_fib(sc);
/*
OpenPOWER on IntegriCloud