From 34e28bf35f7cc7758f87e6a2b82adf6ca186afdb Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Date: Wed, 9 Dec 2009 16:31:41 +0200
Subject: ubiformat: check that min IO size is power of 2

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 ubi-utils/src/ubiformat.c | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'ubi-utils/src')

diff --git a/ubi-utils/src/ubiformat.c b/ubi-utils/src/ubiformat.c
index 681ea30..c87dfd0 100644
--- a/ubi-utils/src/ubiformat.c
+++ b/ubi-utils/src/ubiformat.c
@@ -721,6 +721,11 @@ int main(int argc, char * const argv[])
 		goto out_close_mtd;
 	}
 
+	if (!is_power_of_2(mtd.min_io_size)) {
+		errmsg("min. I/O size is %d, but should be power of 2");
+		goto out_close;
+	}
+
 	if (!mtd_info.sysfs_supported) {
 		/*
 		 * Linux kernels older than 2.6.30 did not support sysfs
-- 
cgit v1.2.3