fw: Initialize automatic variables

This commit is contained in:
Michael Cardell Widerkrantz 2023-03-16 13:51:24 +01:00
parent 226bcbaed1
commit 1f10c8e2db
No known key found for this signature in database
GPG Key ID: D3DB3DDF57E704E5
2 changed files with 9 additions and 9 deletions

View File

@ -93,9 +93,9 @@ static void compute_cdi(const uint8_t digest[32], const uint8_t use_uss,
const uint8_t uss[32])
{
uint32_t local_cdi[8];
blake2s_ctx secure_ctx;
uint32_t rnd_sleep;
int blake2err;
blake2s_ctx secure_ctx = {0};
uint32_t rnd_sleep = 0;
int blake2err = 0;
// Prepare to sleep a random number of cycles before reading out UDS
*timer_prescaler = 1;
@ -250,7 +250,7 @@ static enum state loading_commands(const struct frame_header *hdr,
struct context *ctx)
{
uint8_t rsp[CMDLEN_MAXBYTES] = {0};
int nbytes;
int nbytes = 0;
switch (cmd[0]) {
case FW_CMD_LOAD_APP_DATA:
@ -380,8 +380,8 @@ static void scramble_ram()
int main()
{
struct context ctx = {0};
struct frame_header hdr;
uint8_t cmd[CMDLEN_MAXBYTES];
struct frame_header hdr = {0};
uint8_t cmd[CMDLEN_MAXBYTES] = {0};
enum state state = FW_STATE_INITIAL;
print_hw_version();

View File

@ -24,7 +24,7 @@ uint8_t genhdr(uint8_t id, uint8_t endpoint, uint8_t status, enum cmdlen len)
int readcommand(struct frame_header *hdr, uint8_t *cmd, int state)
{
uint8_t in;
uint8_t in = 0;
*led = (state == FW_STATE_LOADING) ? LED_BLACK : LED_WHITE;
in = readbyte();
@ -91,8 +91,8 @@ int parseframe(uint8_t b, struct frame_header *hdr)
// following data in buf
void fwreply(struct frame_header hdr, enum fwcmd rspcode, uint8_t *buf)
{
size_t nbytes;
enum cmdlen len; // length covering (rspcode + length of buf)
size_t nbytes = 0;
enum cmdlen len = 0; // length covering (rspcode + length of buf)
switch (rspcode) {
case FW_RSP_NAME_VERSION: