Skip to contentSkip to conversation

UBI: fix unaligned leb_start value

PATCH In review John Ogness 2 participants 2 messages Jan 21, 2011 – Jan 25, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 UBI: fix unaligned leb_start value

From: John Ogness <[email protected]>

The wrong header size was used in calculating the data offset. The data offset should be VID header offset + VID header size (aligned to the minimum I/O unit).

---
This patch is against linux-next-20110121.

Since the value is later aligned, this patch does not fix any real world problem. But it should be fixed nonetheless.

 drivers/mtd/ubi/build.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/ubi/build.c +1 -1
index f49e49d..a4f47dd 100644
@@ -737,7 +737,7 @@ static int io_init(struct ubi_device *ubi)
 	}
 
 	/* Similar for the data offset */
-	ubi->leb_start = ubi->vid_hdr_offset + UBI_EC_HDR_SIZE;
+	ubi->leb_start = ubi->vid_hdr_offset + UBI_VID_HDR_SIZE;
 	ubi->leb_start = ALIGN(ubi->leb_start, ubi->min_io_size);
 
 	dbg_msg("vid_hdr_offset   %d", ubi->vid_hdr_offset);
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 7 lines · John Ogness

From: John Ogness <[email protected]>

The wrong header size was used in calculating the data offset. The data offset should be VID header offset + VID header size (aligned to the minimum I/O unit).

I've tweaked the commit message and pushed this to the UBI tree, thanks:
http://git.infradead.org/ubi-2.6.git/commit/a25376636fa6cee8017a22144652f276840281bf

Quoted 5 lines

---
This patch is against linux-next-20110121.

Since the value is later aligned, this patch does not fix any real world problem. But it should be fixed nonetheless.

Not exactly, this does not fix any real problem because UBI_EC_HDR_SIZE and UBI_VID_HDR_SIZE are currently equivalent :-)

Thank you!

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)