]> www.infradead.org Git - mtd-utils.git/commitdiff
ubinize: correctly calculate VID offset when min I/O unit is 1
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 16 Apr 2008 17:47:13 +0000 (20:47 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 16 Apr 2008 17:48:59 +0000 (20:48 +0300)
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/new-utils/src/libubigen.c

index 8d71fdee4a220aedad6e2ba74ec795240fa49c26..34e2c0b06c7777bb638f255813859998b8eb11ae 100644 (file)
@@ -52,8 +52,11 @@ void ubigen_info_init(struct ubigen_info *ui, int peb_size, int min_io_size,
                      int subpage_size, int vid_hdr_offs, int ubi_ver,
                      long long ec)
 {
-       if (!vid_hdr_offs)
-               vid_hdr_offs = subpage_size;
+       if (!vid_hdr_offs) {
+               vid_hdr_offs = UBI_EC_HDR_SIZE + subpage_size - 1;
+               vid_hdr_offs /= subpage_size;
+               vid_hdr_offs *= subpage_size;
+       }
 
        ui->peb_size = peb_size;
        ui->min_io_size = min_io_size;