]> www.infradead.org Git - mtd-utils.git/commitdiff
ubiformat: check that min IO size is power of 2
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 9 Dec 2009 14:31:41 +0000 (16:31 +0200)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 9 Dec 2009 14:31:41 +0000 (16:31 +0200)
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/src/ubiformat.c

index 681ea305794100fdb1b21c60336c09c5807b0ef8..c87dfd026c3334967d4b865ae95f1c32779322c5 100644 (file)
@@ -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