svn commit: r218314 - projects/graid/head/sys/geom/raid
Alexander Motin
mav at FreeBSD.org
Sat Feb 5 09:37:35 UTC 2011
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);
More information about the svn-src-projects
mailing list