From f0c187dd6479996b83f85b6decf303ec0fc70fe5 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 6 Jan 2017 09:10:23 -0800 Subject: [PATCH] ao-tools/ao-usbload: Pad image with 0xff instead of random bits Clear the temporary block to 0xff before copying in the target data so that any unused bytes end up being left at 0xff instead of inheriting whatever data was in the block before. Signed-off-by: Keith Packard --- ao-tools/lib/ao-selfload.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ao-tools/lib/ao-selfload.c b/ao-tools/lib/ao-selfload.c index 0a23dfda..754cd784 100644 --- a/ao-tools/lib/ao-selfload.c +++ b/ao-tools/lib/ao-selfload.c @@ -110,6 +110,7 @@ ao_self_write(struct cc_usb *cc, struct ao_hex_image *image) start = image->address; if (stop > image->address + image->length) stop = image->address + image->length; + memset(block, 0xff, 0x100); memcpy(block + start - address, image->data + start - image->address, stop - start); ao_self_block_write(cc, address, block); ao_self_block_read(cc, address, check); -- 2.30.2