summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authoroster <oster@NetBSD.org>2008-05-04 20:57:23 +0000
committeroster <oster@NetBSD.org>2008-05-04 20:57:23 +0000
commit5a9093cfac385b8241ccbc3f49f528f52b6870d9 (patch)
tree57528f27d8f52f5a8b1e7400405078f0ae0e388d /sys/dev/raidframe
parent63b0503310315ffdd8ce593a2bf44d9675ed4282 (diff)
Both StripeUnitsPerParityUnit and StripeUnitsPerReconstructUnit need
to be positive integers.
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_layout.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/sys/dev/raidframe/rf_layout.c b/sys/dev/raidframe/rf_layout.c
index 926029a383c..c3a19aa3908 100644
--- a/sys/dev/raidframe/rf_layout.c
+++ b/sys/dev/raidframe/rf_layout.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_layout.c,v 1.19 2008/04/20 20:42:32 oster Exp $ */
+/* $NetBSD: rf_layout.c,v 1.20 2008/05/04 20:57:23 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_layout.c,v 1.19 2008/04/20 20:42:32 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_layout.c,v 1.20 2008/05/04 20:57:23 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -415,7 +415,21 @@ rf_ConfigureLayout(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
if (layoutPtr->sectorsPerStripeUnit <= 0) {
RF_ERRORMSG2("raid%d: Invalid sectorsPerStripeUnit: %d\n",
raidPtr->raidid,
- (int)layoutPtr->sectorsPerStripeUnit );
+ (int)layoutPtr->sectorsPerStripeUnit);
+ return (EINVAL);
+ }
+
+ if (layoutPtr->SUsPerPU <= 0) {
+ RF_ERRORMSG2("raid%d: Invalid StripeUnitsPerParityUnit: %d\n",
+ raidPtr->raidid,
+ (int)layoutPtr->SUsPerPU);
+ return (EINVAL);
+ }
+
+ if (layoutPtr->SUsPerRU <= 0) {
+ RF_ERRORMSG2("raid%d: Invalid StripeUnitsPerReconstructUnit: %d\n",
+ raidPtr->raidid,
+ (int)layoutPtr->SUsPerRU);
return (EINVAL);
}