diff mbox

ffu: Fix usage of sect_size

Message ID 20180626064808.183086-1-gwendal@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Gwendal Grignou June 26, 2018, 6:48 a.m. UTC
Read firmware image in chunch of sect_size bytes, to support non 512B
sector size.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 mmc_cmds.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/mmc_cmds.c b/mmc_cmds.c
index 44623fe..cf59edf 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -2427,7 +2427,7 @@  int do_ffu(int nargs, char **argv)
 		exit(1);
 	}
 
-	buf = malloc(512);
+	buf = malloc(4096);
 	multi_cmd = calloc(1, sizeof(struct mmc_ioc_multi_cmd) +
 				3 * sizeof(struct mmc_ioc_cmd));
 	if (!buf || !multi_cmd) {
@@ -2510,7 +2510,7 @@  int do_ffu(int nargs, char **argv)
 do_retry:
 	/* read firmware chunk */
 	lseek(img_fd, 0, SEEK_SET);
-	chunk_size = read(img_fd, buf, 512);
+	chunk_size = read(img_fd, buf, sect_size);
 
 	while (chunk_size > 0) {
 		/* send ioctl with multi-cmd */
@@ -2548,7 +2548,7 @@  do_retry:
 		}
 
 		/* read the next firmware chunk (if any) */
-		chunk_size = read(img_fd, buf, 512);
+		chunk_size = read(img_fd, buf, sect_size);
 	}
 
 	if ((sect_done * sect_size) == fw_size) {