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
This commit is contained in:
Pawel Jakub Dawidek 2014-01-04 09:27:49 +00:00
parent b298769db3
commit 41f48b56d0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=260254

View File

@ -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;
}