Date: Wed, 12 Jan 2011 13:55:01 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r217305 - in head: sbin/geom/class/raid3 sys/geom/raid3 Message-ID: <201101121355.p0CDt1ct090888@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Wed Jan 12 13:55:01 2011 New Revision: 217305 URL: http://svn.freebsd.org/changeset/base/217305 Log: 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 Modified: head/sbin/geom/class/raid3/geom_raid3.c head/sys/geom/raid3/g_raid3.c Modified: head/sbin/geom/class/raid3/geom_raid3.c ============================================================================== --- head/sbin/geom/class/raid3/geom_raid3.c Wed Jan 12 13:16:35 2011 (r217304) +++ head/sbin/geom/class/raid3/geom_raid3.c Wed Jan 12 13:55:01 2011 (r217305) @@ -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. */ Modified: head/sys/geom/raid3/g_raid3.c ============================================================================== --- head/sys/geom/raid3/g_raid3.c Wed Jan 12 13:16:35 2011 (r217304) +++ head/sys/geom/raid3/g_raid3.c Wed Jan 12 13:55:01 2011 (r217305) @@ -2913,6 +2913,10 @@ g_raid3_read_metadata(struct g_consumer cp->provider->name); return (error); } + if (md->md_sectorsize > MAXPHYS) { + G_RAID3_DEBUG(0, "The blocksize is too big."); + return (EINVAL); + } return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101121355.p0CDt1ct090888>