From ec98c85a0590ff264293256a8d3cb7b577009f56 Mon Sep 17 00:00:00 2001 From: Hinnerk van Bruinehsen Date: Thu, 16 Oct 2014 12:02:11 +0200 Subject: [PATCH] lint: fix unusedVariable warnings SQUASH ME: into unusedVariable (annotated) SQUASH ME: into unusedVariable (II) SQUASH ME: into unreadVariable (II) --- cpu/cc430/cc110x_cc430.c | 4 ++++ cpu/lpc1768/startup.c | 4 ++-- sys/crypto/twofish.c | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cpu/cc430/cc110x_cc430.c b/cpu/cc430/cc110x_cc430.c index 2b77c9701..028264c8d 100644 --- a/cpu/cc430/cc110x_cc430.c +++ b/cpu/cc430/cc110x_cc430.c @@ -119,6 +119,8 @@ void cc110x_write_reg(uint8_t addr, uint8_t value) while (!(RFDINIFG & RF1AIFCTL1)); + /* cppcheck: need to force a read to RF1ADOUTB to trigger reset */ + /* cppcheck-suppress unreadVariable */ i = RF1ADOUTB; /* Reset RFDOUTIFG flag which contains status byte */ restoreIRQ(int_state); @@ -213,6 +215,8 @@ uint8_t cc110x_writeburst_reg(uint8_t addr, char *buffer, uint8_t count) while (!(RFDINIFG & RF1AIFCTL1)); /* Wait for TX to finish */ } + /* cppcheck: need to force a read to RF1ADOUTB to trigger reset */ + /* cppcheck-suppress unreadVariable */ i = RF1ADOUTB; /* Reset RFDOUTIFG flag which contains status byte */ restoreIRQ(int_state); diff --git a/cpu/lpc1768/startup.c b/cpu/lpc1768/startup.c index 9abeb3197..dad6cb746 100644 --- a/cpu/lpc1768/startup.c +++ b/cpu/lpc1768/startup.c @@ -190,7 +190,7 @@ void (* const g_pfnVectors[])(void) = *******************************************************************************/ void Reset_Handler(void) { - unsigned long *pulSrc, *pulDest; + unsigned long *pulDest; /* * This used for cleaning AHBRAM0 section @@ -218,7 +218,7 @@ void Reset_Handler(void) * Copy the data segment initializers from flash to SRAM in ROM mode */ #if (__RAM_MODE__==0) - pulSrc = &__sidata; + unsigned long *pulSrc = &__sidata; for(pulDest = &__data_start__; pulDest < &__data_end__; ) { *(pulDest++) = *(pulSrc++); diff --git a/sys/crypto/twofish.c b/sys/crypto/twofish.c index 373b34ccc..22419bdc8 100644 --- a/sys/crypto/twofish.c +++ b/sys/crypto/twofish.c @@ -523,15 +523,24 @@ static int twofish_set_key(twofish_context_t *ctx, uint8_t *key, uint8_t keylen) int i, j, k; /* Temporaries for CALC_K. */ + /* cppcheck: used in macros in sys/include/crypto/twofish.h that cppcheck + * doesn't understand + */ + /* cppcheck-suppress unusedVariable */ uint32_t x, y; /* The S vector used to key the S-boxes, split up into individual bytes. * 128-bit keys use only sa through sh; 256-bit use all of them. */ uint8_t sa = 0, sb = 0, sc = 0, sd = 0, se = 0, sf = 0, sg = 0, sh = 0; + /* cppcheck: moving this may introduce timing vulnerability */ /* cppcheck-suppress variableScope */ uint8_t si = 0, sj = 0, sk = 0, sl = 0, sm = 0, sn = 0, so = 0, sp = 0; /* Temporary for CALC_S. */ + /* cppcheck: used in macros in sys/include/crypto/twofish.h that cppcheck + * doesn't understand + */ + /* cppcheck-suppress unusedVariable */ uint8_t tmp; /* Check key length. */ @@ -674,6 +683,10 @@ int twofish_encrypt(cipher_context_t *context, uint8_t *in, uint8_t *out) uint32_t a, b, c, d; /* Temporaries used by the round function. */ + /* cppcheck: used in macros in sys/include/crypto/twofish.h that cppcheck + * doesn't understand + */ + /* cppcheck-suppress unusedVariable */ uint32_t x, y; /* Input whitening and packing. */ @@ -727,6 +740,10 @@ int twofish_decrypt(cipher_context_t *context, uint8_t *in, uint8_t *out) uint32_t a, b, c, d; /* Temporaries used by the round function. */ + /* cppcheck: used in macros in sys/include/crypto/twofish.h that cppcheck + * doesn't understand + */ + /* cppcheck-suppress unusedVariable */ uint32_t x, y; /* Input whitening and packing. */