diff mbox

[U-Boot,8/9] mkenvimage: Really set the redundant byte when applicable

Message ID 1322080098-3151-9-git-send-email-david.wagner@free-electrons.com
State Superseded
Headers show

Commit Message

David Wagner Nov. 23, 2011, 8:28 p.m. UTC
Signed-off-by: David Wagner <david.wagner@free-electrons.com>
---
 tools/mkenvimage.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Mike Frysinger Nov. 25, 2011, 9:36 p.m. UTC | #1
On Wednesday 23 November 2011 15:28:17 David Wagner wrote:
> --- a/tools/mkenvimage.c
> +++ b/tools/mkenvimage.c
> 
> +	if (redundant)
> +		*(dataptr + sizeof(targetendian_crc)) = 1;

dataptr[sizeof(targetendian_crc)] = 1;
-mike
diff mbox

Patch

diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c
index 8d84c85..fa6eb6e 100644
--- a/tools/mkenvimage.c
+++ b/tools/mkenvimage.c
@@ -257,7 +257,9 @@  int main(int argc, char **argv)
 	crc = crc32(0, envptr, envsize);
 	targetendian_crc = bigendian ? cpu_to_be32(crc) : cpu_to_le32(crc);
 
-	memcpy(dataptr, &targetendian_crc, sizeof(uint32_t));
+	memcpy(dataptr, &targetendian_crc, sizeof(targetendian_crc));
+	if (redundant)
+		*(dataptr + sizeof(targetendian_crc)) = 1;
 
 	bin_fd = creat(bin_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
 	if (bin_fd == -1) {