Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Feb 2011 09:37:34 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r218314 - projects/graid/head/sys/geom/raid
Message-ID:  <201102050937.p159bY6D021712@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Feb  5 09:37:34 2011
New Revision: 218314
URL: http://svn.freebsd.org/changeset/base/218314

Log:
  Add check that size and strip arguments are positive. Mostly do it because
  of mossing optional arguments support in 7-STABLE.

Modified:
  projects/graid/head/sys/geom/raid/md_intel.c

Modified: projects/graid/head/sys/geom/raid/md_intel.c
==============================================================================
--- projects/graid/head/sys/geom/raid/md_intel.c	Sat Feb  5 06:26:16 2011	(r218313)
+++ projects/graid/head/sys/geom/raid/md_intel.c	Sat Feb  5 09:37:34 2011	(r218314)
@@ -1364,7 +1364,8 @@ makedisk:
 		/* Handle size argument. */
 		len = sizeof(*sizearg);
 		sizearg = gctl_get_param(req, "size", &len);
-		if (sizearg != NULL && len == sizeof(*sizearg)) {
+		if (sizearg != NULL && len == sizeof(*sizearg) &&
+		    *sizearg > 0) {
 			if (*sizearg > size) {
 				gctl_error(req, "Size too big %lld > %lld.",
 				    (long long)*sizearg, (long long)size);
@@ -1377,7 +1378,8 @@ makedisk:
 		strip = 131072;
 		len = sizeof(*striparg);
 		striparg = gctl_get_param(req, "strip", &len);
-		if (striparg != NULL && len == sizeof(*striparg)) {
+		if (striparg != NULL && len == sizeof(*striparg) &&
+		    *striparg > 0) {
 			if (*striparg < sectorsize) {
 				gctl_error(req, "Strip size too small.");
 				return (-10);
@@ -1536,7 +1538,8 @@ makedisk:
 		/* Handle size argument. */
 		len = sizeof(*sizearg);
 		sizearg = gctl_get_param(req, "size", &len);
-		if (sizearg != NULL && len == sizeof(*sizearg)) {
+		if (sizearg != NULL && len == sizeof(*sizearg) &&
+		    *sizearg > 0) {
 			if (*sizearg > size) {
 				gctl_error(req, "Size too big %lld > %lld.",
 				    (long long)*sizearg, (long long)size);
@@ -1549,7 +1552,8 @@ makedisk:
 		strip = 131072;
 		len = sizeof(*striparg);
 		striparg = gctl_get_param(req, "strip", &len);
-		if (striparg != NULL && len == sizeof(*striparg)) {
+		if (striparg != NULL && len == sizeof(*striparg) &&
+		    *striparg > 0) {
 			if (*striparg < sectorsize) {
 				gctl_error(req, "Strip size too small.");
 				return (-10);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102050937.p159bY6D021712>