[PATCH 2/2] fastboot: ubiformat: Fix writing sparse images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



in ubiformat_write() we may not write trailing empty areas in erase
blocks as UBI assumes them to be empty and writable.

This code path is used when fastboot handles sparse images.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 common/ubiformat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/ubiformat.c b/common/ubiformat.c
index 1edfc5b2a3..d8399ad9d6 100644
--- a/common/ubiformat.c
+++ b/common/ubiformat.c
@@ -745,6 +745,7 @@ int ubiformat_write(struct mtd_info *mtd, const void *buf, size_t count,
 
 	while (count) {
 		size_t now = mtd->erasesize - offset_in_peb;
+		int new_len;
 
 		if (now > count)
 			now = count;
@@ -780,7 +781,8 @@ int ubiformat_write(struct mtd_info *mtd, const void *buf, size_t count,
 			}
 		}
 
-		ret = mtd_peb_write(mtd, buf, peb, offset_in_peb, now);
+		new_len = drop_ffs(mtd, buf, now);
+		ret = mtd_peb_write(mtd, buf, peb, offset_in_peb, new_len);
 		if (ret < 0)
 			return ret;
 
-- 
2.30.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux