Sector size can not be greater than MAXPHYS. Since GRAID3 calculates

sector size from user-specified block size, report to user about
big blocksize.

PR:		kern/147851
MFC after:	1 week
This commit is contained in:
Andrey V. Elsukov 2011-01-12 13:55:01 +00:00
parent ab7a71f6e7
commit 95959703e1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217305
2 changed files with 9 additions and 0 deletions

View File

@ -213,6 +213,11 @@ raid3_label(struct gctl_req *req)
md.md_sectorsize = sectorsize * (nargs - 2);
md.md_mediasize -= (md.md_mediasize % md.md_sectorsize);
if (md.md_sectorsize > MAXPHYS) {
gctl_error(req, "The blocksize is too big.");
return;
}
/*
* Clear last sector first, to spoil all components if device exists.
*/

View File

@ -2913,6 +2913,10 @@ g_raid3_read_metadata(struct g_consumer *cp, struct g_raid3_metadata *md)
cp->provider->name);
return (error);
}
if (md->md_sectorsize > MAXPHYS) {
G_RAID3_DEBUG(0, "The blocksize is too big.");
return (EINVAL);
}
return (0);
}