From 76296a44d8adb72e121634bd8997dde8f58b486d Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Mon, 15 Aug 2022 21:01:21 +0200 Subject: [PATCH] uninitialized fix --- sw/controller/src/update.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sw/controller/src/update.c b/sw/controller/src/update.c index 4578bfc..a8c2c99 100644 --- a/sw/controller/src/update.c +++ b/sw/controller/src/update.c @@ -38,7 +38,7 @@ static uint8_t status_data[12] = { static uint32_t update_checksum (uint32_t address, uint32_t length) { uint32_t remaining = length; uint32_t block_size; - uint32_t checksum; + uint32_t checksum = 0; uint8_t buffer[32]; hw_crc32_reset(); @@ -46,7 +46,7 @@ static uint32_t update_checksum (uint32_t address, uint32_t length) { for (uint32_t i = 0; i < length; i += sizeof(buffer)) { block_size = (remaining > sizeof(buffer)) ? sizeof(buffer) : remaining; fpga_mem_read(address, block_size, buffer); - checksum = hw_crc32_calculate(buffer, sizeof(buffer)); + checksum = hw_crc32_calculate(buffer, block_size); remaining -= block_size; }