summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authoroster <oster@NetBSD.org>2006-03-23 03:43:54 +0000
committeroster <oster@NetBSD.org>2006-03-23 03:43:54 +0000
commit6c4936b6da4f828f193cebc14eb3991af5dc166f (patch)
treeeef9fb2bb26845463acbc134a26ae8334415dd31 /sys/dev/raidframe
parent6883d3cdd34201ea1fcc731b98da9acdd4452e0f (diff)
This one is good for making one's brain hurt. Turns out that the
original RAIDframe code had the same bug with dag_h being used when possibly NULL. Use dagList as the starting point for any potential dag_h's. Move the initialization of dag_h in this part to a little later. Loop now runs through in equivalent lock-step with the construction of the dagList earlier in the function. Addresses Coverity CID 1129 (id=6841 Run 5).
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_aselect.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/raidframe/rf_aselect.c b/sys/dev/raidframe/rf_aselect.c
index 0dfe343e6f9..4c796feefa3 100644
--- a/sys/dev/raidframe/rf_aselect.c
+++ b/sys/dev/raidframe/rf_aselect.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_aselect.c,v 1.23 2006/03/18 17:34:31 oster Exp $ */
+/* $NetBSD: rf_aselect.c,v 1.24 2006/03/23 03:43:54 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -33,7 +33,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_aselect.c,v 1.23 2006/03/18 17:34:31 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_aselect.c,v 1.24 2006/03/23 03:43:54 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -441,12 +441,6 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t *desc, RF_RaidAccessFlags_t flags)
if ((numStripesBailed > 0) || (numStripeUnitsBailed > 0)) {
stripeNum = 0;
stripeUnitNum = 0;
- if (dag_h->asmList) {
- endASMList = dag_h->asmList;
- while (endASMList->next)
- endASMList = endASMList->next;
- } else
- endASMList = NULL;
/* walk through io, stripe by stripe */
/* here we build up dag_h->asmList for this dag...
we need all of these asm's to do the IO, and
@@ -454,8 +448,19 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t *desc, RF_RaidAccessFlags_t flags)
later time */
stripeFuncs = stripeFuncsList;
failed_stripe = failed_stripes_list;
+ dagList = desc->dagList;
+
for (i = 0, asm_p = asmap; asm_p; asm_p = asm_p->next, i++) {
- if (stripeFuncs->fp == NULL) {
+
+ dag_h = dagList->dags;
+ if (dag_h->asmList) {
+ endASMList = dag_h->asmList;
+ while (endASMList->next)
+ endASMList = endASMList->next;
+ } else
+ endASMList = NULL;
+
+ if (stripeFuncs->fp == NULL) {
numStripeUnits = asm_p->numStripeUnitsAccessed;
/* walk through stripe, stripe unit by
* stripe unit */
@@ -495,6 +500,7 @@ rf_SelectAlgorithm(RF_RaidAccessDesc_t *desc, RF_RaidAccessFlags_t flags)
stripeNum++;
failed_stripe = failed_stripe->next;
}
+ dagList = dagList->next; /* need to move in stride with stripeFuncs */
stripeFuncs = stripeFuncs->next;
}
RF_ASSERT(stripeNum == numStripesBailed);