Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/raidframe The number of components used must be at l...



details:   https://anonhg.NetBSD.org/src/rev/56bfeb51eec1
branches:  trunk
changeset: 1022521:56bfeb51eec1
user:      oster <oster%NetBSD.org@localhost>
date:      Fri Jul 23 22:34:12 2021 +0000

description:
The number of components used must be at least 2.  An odd number of components
is not allowed.

PR bin/45162

diffstat:

 sys/dev/raidframe/rf_raid1.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 52e551dccf53 -r 56bfeb51eec1 sys/dev/raidframe/rf_raid1.c
--- a/sys/dev/raidframe/rf_raid1.c      Fri Jul 23 21:53:33 2021 +0000
+++ b/sys/dev/raidframe/rf_raid1.c      Fri Jul 23 22:34:12 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_raid1.c,v 1.38 2021/07/23 00:54:45 oster Exp $      */
+/*     $NetBSD: rf_raid1.c,v 1.39 2021/07/23 22:34:12 oster Exp $      */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  *****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.38 2021/07/23 00:54:45 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.39 2021/07/23 22:34:12 oster Exp $");
 
 #include "rf_raid.h"
 #include "rf_raid1.h"
@@ -65,6 +65,11 @@
        RF_Raid1ConfigInfo_t *info;
        RF_RowCol_t i;
 
+       /* Sanity check the number of columns... */
+       if (raidPtr->numCol < 2 || raidPtr->numCol % 2 != 0) {
+               return (EINVAL);
+       }
+       
        /* create a RAID level 1 configuration structure */
        info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList);
        if (info == NULL)



Home | Main Index | Thread Index | Old Index