svn commit: r260254 - head/sbin/geom/class/eli

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Jan 4 09:27:50 UTC 2014


Author: pjd
Date: Sat Jan  4 09:27:49 2014
New Revision: 260254
URL: http://svnweb.freebsd.org/changeset/base/260254

Log:
  Don't allow to create GELI providers with a sector size, which is no a
  power of 2.
  
  Noticed by:	rwatson
  MFC after:	3 days

Modified:
  head/sbin/geom/class/eli/geom_eli.c

Modified: head/sbin/geom/class/eli/geom_eli.c
==============================================================================
--- head/sbin/geom/class/eli/geom_eli.c	Sat Jan  4 09:25:27 2014	(r260253)
+++ head/sbin/geom/class/eli/geom_eli.c	Sat Jan  4 09:27:49 2014	(r260254)
@@ -789,7 +789,7 @@ eli_init(struct gctl_req *req)
 	if (val == 0)
 		md.md_sectorsize = secsize;
 	else {
-		if (val < 0 || (val % secsize) != 0) {
+		if (val < 0 || (val % secsize) != 0 || !powerof2(val)) {
 			gctl_error(req, "Invalid sector size.");
 			return;
 		}


More information about the svn-src-head mailing list