diff --git a/cpu/lpc1768/periph/gpio.c b/cpu/lpc1768/periph/gpio.c index c876f9050b81..3ac26d15c6e2 100644 --- a/cpu/lpc1768/periph/gpio.c +++ b/cpu/lpc1768/periph/gpio.c @@ -231,7 +231,7 @@ void isr_eint3(void) /* invoke all handlers */ for (int i = 0; i < NUMOF_IRQS; i++) { - if (status & (1 << i)) { + if (status & ((uint32_t)1 << i)) { isr_ctx[i].cb(isr_ctx[i].arg); LPC_GPIOINT->IO0IntClr |= (1 << i); diff --git a/cpu/native/irq_cpu.c b/cpu/native/irq_cpu.c index 9e265ba6094c..f443585a659b 100644 --- a/cpu/native/irq_cpu.c +++ b/cpu/native/irq_cpu.c @@ -229,7 +229,7 @@ int irq_is_in(void) int _native_popsig(void) { int nread, nleft, i; - int sig; + int sig = 0; nleft = sizeof(int); i = 0; diff --git a/cpu/sam3/periph/gpio.c b/cpu/sam3/periph/gpio.c index 4eee2a15050e..b1b909345121 100644 --- a/cpu/sam3/periph/gpio.c +++ b/cpu/sam3/periph/gpio.c @@ -314,7 +314,7 @@ static inline void isr_handler(Pio *port, int port_num) uint32_t status = (port->PIO_ISR & port->PIO_IMR); for (int i = 0; i < 32; i++) { - if (status & (1 << i)) { + if (status & ((uint32_t)1 << i)) { int ctx = _ctx(port_num, i); exti_ctx[ctx].cb(exti_ctx[ctx].arg); } diff --git a/dist/tools/ethos/ethos.c b/dist/tools/ethos/ethos.c index 1f45f7308314..626ffd6e88aa 100644 --- a/dist/tools/ethos/ethos.c +++ b/dist/tools/ethos/ethos.c @@ -261,7 +261,6 @@ static void _write_escaped(int fd, char* buf, ssize_t n) /* Our workaround is to prepare the data to send in a local buffer and then * call write() on the buffer instead of one char at a time */ uint8_t out[SERIAL_BUFFER_SIZE]; - size_t escaped = 0; size_t buffered = 0; while(n--) { @@ -269,7 +268,6 @@ static void _write_escaped(int fd, char* buf, ssize_t n) if (c == LINE_FRAME_DELIMITER || c == LINE_ESC_CHAR) { out[buffered++] = LINE_ESC_CHAR; c ^= 0x20; - ++escaped; if (buffered >= SERIAL_BUFFER_SIZE) { checked_write(fd, out, buffered); buffered = 0; diff --git a/pkg/u8g2/src/csrc/u8g2_riotos.c b/pkg/u8g2/src/csrc/u8g2_riotos.c index 20c75e83346b..ae633c8ddbba 100644 --- a/pkg/u8g2/src/csrc/u8g2_riotos.c +++ b/pkg/u8g2/src/csrc/u8g2_riotos.c @@ -59,7 +59,7 @@ static void u8x8_enable_pins(gpio_t* pins, uint32_t pins_enabled) uint8_t i; for (i = 0; i < 32; i++) { - if (pins_enabled & (1 << i)) { + if (pins_enabled & ((uint32_t)1 << i)) { if (pins[i] != GPIO_UNDEF) { if (i < U8X8_PIN_OUTPUT_CNT) { gpio_init(pins[i], GPIO_OUT); diff --git a/pkg/ucglib/src/csrc/ucg_riotos.c b/pkg/ucglib/src/csrc/ucg_riotos.c index 892847b876e5..bf10f22e754a 100644 --- a/pkg/ucglib/src/csrc/ucg_riotos.c +++ b/pkg/ucglib/src/csrc/ucg_riotos.c @@ -53,7 +53,7 @@ static void ucg_enable_pins(gpio_t *pins, uint32_t pins_enabled) uint8_t i; for (i = 0; i < 32; i++) { - if (pins_enabled & (1 << i)) { + if (pins_enabled & ((uint32_t)1 << i)) { if (pins[i] != GPIO_UNDEF) { if (i < UCG_PIN_COUNT) { gpio_init(pins[i], GPIO_OUT); diff --git a/sys/cb_mux/cb_mux.c b/sys/cb_mux/cb_mux.c index 0a8164ebcf7f..e39885138bcb 100644 --- a/sys/cb_mux/cb_mux.c +++ b/sys/cb_mux/cb_mux.c @@ -41,7 +41,7 @@ cb_mux_t *cb_mux_find_cbid(cb_mux_t *head, cb_mux_cbid_t cbid_val) cb_mux_t *cb_mux_find_low(cb_mux_t *head) { - cb_mux_t *entry; + cb_mux_t *entry = NULL; cb_mux_t *entry_low = NULL; cb_mux_cbid_t id = (cb_mux_cbid_t)(-1); @@ -60,7 +60,7 @@ cb_mux_t *cb_mux_find_low(cb_mux_t *head) cb_mux_t *cb_mux_find_high(cb_mux_t *head) { - cb_mux_t *entry; + cb_mux_t *entry = NULL; cb_mux_t *entry_high = NULL; cb_mux_cbid_t id = 0; @@ -81,7 +81,7 @@ cb_mux_cbid_t cb_mux_find_free_id(cb_mux_t *head) { uint32_t free; cb_mux_cbid_t block; - cb_mux_t *entry; + cb_mux_t *entry = NULL; uint8_t num; /* Search for free IDs in blocks of 32 IDs */ @@ -105,7 +105,7 @@ cb_mux_cbid_t cb_mux_find_free_id(cb_mux_t *head) /* Find which ID in block was free */ for (num = 0; num < 32; num++) { - if (~free & (1 << num)) { + if (~free & ((uint32_t)1 << num)) { return block | num; } } @@ -116,7 +116,7 @@ cb_mux_cbid_t cb_mux_find_free_id(cb_mux_t *head) void cb_mux_iter(cb_mux_t *head, cb_mux_iter_t func, void *arg) { - cb_mux_t *entry; + cb_mux_t *entry = NULL; LL_FOREACH(head, entry) { func(entry, arg); diff --git a/sys/include/net/gnrc/gomach/gomach.h b/sys/include/net/gnrc/gomach/gomach.h index 5f2135a25670..1f7d7fb307a8 100644 --- a/sys/include/net/gnrc/gomach/gomach.h +++ b/sys/include/net/gnrc/gomach/gomach.h @@ -85,6 +85,9 @@ extern "C" { #define GNRC_GOMACH_SUPERFRAME_DURATION_US (300LU * US_PER_MS) #endif +#ifndef RTT_FREQUENCY +#error "RTT_FREQUENCY undefined." +#else #if ((GNRC_GOMACH_SUPERFRAME_DURATION_US < ((1000LU *US_PER_MS) / RTT_FREQUENCY)) || \ (GNRC_GOMACH_SUPERFRAME_DURATION_US < (10 *GNRC_GOMACH_CP_DURATION_US))) #undef GNRC_GOMACH_SUPERFRAME_DURATION_US @@ -94,6 +97,7 @@ extern "C" { #define GNRC_GOMACH_SUPERFRAME_DURATION_US (10 * GNRC_GOMACH_CP_DURATION_US) #endif #endif +#endif /** * @brief The maximum duration of the random period at the end of GoMacH's diff --git a/sys/net/network_layer/fib/fib.c b/sys/net/network_layer/fib/fib.c index 80fdad55cc3c..99035d6fe594 100644 --- a/sys/net/network_layer/fib/fib.c +++ b/sys/net/network_layer/fib/fib.c @@ -711,7 +711,7 @@ static int fib_sr_check_lifetime(fib_sr_t *fib_sr) fib_sr->sr_lifetime = 0; if (fib_sr->sr_path != NULL) { - fib_sr_entry_t *elt; + fib_sr_entry_t *elt = NULL; LL_FOREACH(fib_sr->sr_path, elt) { universal_address_rem(elt->address); } @@ -854,7 +854,7 @@ int fib_sr_delete(fib_table_t *table, fib_sr_t *fib_sr) fib_sr->sr_lifetime = 0; if (fib_sr->sr_path != NULL) { - fib_sr_entry_t *elt, *tmp; + fib_sr_entry_t *elt = NULL, *tmp = NULL; LL_FOREACH_SAFE(fib_sr->sr_path, elt, tmp) { universal_address_rem(elt->address); elt->address = NULL; @@ -920,7 +920,7 @@ int fib_sr_search(fib_table_t *table, fib_sr_t *fib_sr, uint8_t *addr, size_t ad return -ENOENT; } - fib_sr_entry_t *elt; + fib_sr_entry_t *elt = NULL; LL_FOREACH(fib_sr->sr_path, elt) { size_t addr_size_match = addr_size << 3; if (universal_address_compare(elt->address, addr, &addr_size_match) == UNIVERSAL_ADDRESS_EQUAL) { @@ -953,7 +953,7 @@ int fib_sr_entry_append(fib_table_t *table, fib_sr_t *fib_sr, return -ENOENT; } - fib_sr_entry_t *elt; + fib_sr_entry_t *elt = NULL; LL_FOREACH(fib_sr->sr_path, elt) { size_t addr_size_match = addr_size << 3; if (universal_address_compare(elt->address, addr, &addr_size_match) == UNIVERSAL_ADDRESS_EQUAL) { @@ -999,7 +999,7 @@ int fib_sr_entry_add(fib_table_t *table, fib_sr_t *fib_sr, } bool found = false; - fib_sr_entry_t *elt; + fib_sr_entry_t *elt = NULL; LL_FOREACH(fib_sr->sr_path, elt) { size_t addr_size_match = addr_size << 3; if (universal_address_compare(elt->address, addr, &addr_size_match) == UNIVERSAL_ADDRESS_EQUAL) { @@ -1023,7 +1023,7 @@ int fib_sr_entry_add(fib_table_t *table, fib_sr_t *fib_sr, new_entry[0]->next = remaining; } else { - fib_sr_entry_t *elt, *tmp; + fib_sr_entry_t *elt = NULL, *tmp = NULL; LL_FOREACH_SAFE(remaining, elt, tmp) { universal_address_rem(elt->address); elt->address = NULL; @@ -1053,7 +1053,7 @@ int fib_sr_entry_delete(fib_table_t *table, fib_sr_t *fib_sr, uint8_t *addr, siz return -ENOENT; } - fib_sr_entry_t *elt, *tmp; + fib_sr_entry_t *elt = NULL, *tmp; tmp = fib_sr->sr_path; LL_FOREACH(fib_sr->sr_path, elt) { size_t addr_size_match = addr_size << 3; @@ -1064,7 +1064,7 @@ int fib_sr_entry_delete(fib_table_t *table, fib_sr_t *fib_sr, uint8_t *addr, siz tmp->next = elt->next; } else { - fib_sr_entry_t *elt_del, *tmp_del; + fib_sr_entry_t *elt_del = NULL, *tmp_del = NULL; LL_FOREACH_SAFE(tmp, elt_del, tmp_del) { universal_address_rem(elt_del->address); elt_del->address = NULL; @@ -1104,7 +1104,7 @@ int fib_sr_entry_overwrite(fib_table_t *table, fib_sr_t *fib_sr, return -ENOENT; } - fib_sr_entry_t *elt, *elt_repl; + fib_sr_entry_t *elt = NULL, *elt_repl; elt_repl = NULL; LL_FOREACH(fib_sr->sr_path, elt) { size_t addr_old_size_match = addr_old_size << 3; @@ -1153,7 +1153,7 @@ int fib_sr_entry_get_address(fib_table_t *table, fib_sr_t *fib_sr, fib_sr_entry_ return -ENOENT; } - fib_sr_entry_t *elt; + fib_sr_entry_t *elt = NULL; LL_FOREACH(fib_sr->sr_path, elt) { if (elt == sr_entry) { if (universal_address_get_address(elt->address, addr, addr_size) != NULL) { @@ -1190,7 +1190,7 @@ fib_sr_t* hit = NULL; for (size_t i = 0; i < table->size; ++i) { if (table->data.source_routes->headers[i].sr_lifetime != 0) { - fib_sr_entry_t *elt; + fib_sr_entry_t *elt = NULL; LL_FOREACH(table->data.source_routes->headers[i].sr_path, elt) { size_t addr_size_match = dst_size << 3; if (universal_address_compare(elt->address, dst, &addr_size_match) == UNIVERSAL_ADDRESS_EQUAL) { @@ -1221,7 +1221,7 @@ fib_sr_t* hit = NULL; new_sr->sr_path = NULL; /* and the path until the searched destination */ - fib_sr_entry_t *elt_iter, *elt_add = NULL; + fib_sr_entry_t *elt_iter = NULL, *elt_add = NULL; LL_FOREACH(table->data.source_routes->headers[i].sr_path, elt_iter) { fib_sr_entry_t *new_entry; @@ -1365,7 +1365,7 @@ int fib_sr_get_route(fib_table_t *table, uint8_t *dst, size_t dst_size, kernel_p hit->sr_lifetime = 0; if (hit->sr_path != NULL) { - fib_sr_entry_t *elt, *tmp; + fib_sr_entry_t *elt = NULL, *tmp = NULL; LL_FOREACH_SAFE(hit->sr_path, elt, tmp) { universal_address_rem(elt->address); elt->address = NULL; diff --git a/sys/net/routing/nhdp/iib_table.c b/sys/net/routing/nhdp/iib_table.c index 4b7570ec5062..fca78e2d2ca4 100644 --- a/sys/net/routing/nhdp/iib_table.c +++ b/sys/net/routing/nhdp/iib_table.c @@ -103,7 +103,7 @@ iib_link_set_entry_t *iib_process_hello(kernel_pid_t if_pid, nib_entry_t *nb_elt uint64_t validity_time, uint8_t is_sym_nb, uint8_t is_lost) { - iib_base_entry_t *base_elt; + iib_base_entry_t *base_elt = NULL; iib_link_set_entry_t *ls_entry = NULL; timex_t now; @@ -138,9 +138,9 @@ iib_link_set_entry_t *iib_process_hello(kernel_pid_t if_pid, nib_entry_t *nb_elt void iib_fill_wr_addresses(kernel_pid_t if_pid, struct rfc5444_writer *wr) { - iib_base_entry_t *base_elt; - iib_link_set_entry_t *ls_elt; - nhdp_addr_entry_t *addr_elt; + iib_base_entry_t *base_elt = NULL; + iib_link_set_entry_t *ls_elt = NULL; + nhdp_addr_entry_t *addr_elt = NULL; timex_t now; mutex_lock(&mtx_iib_access); @@ -214,8 +214,8 @@ void iib_fill_wr_addresses(kernel_pid_t if_pid, struct rfc5444_writer *wr) void iib_update_lt_status(timex_t *now) { - iib_base_entry_t *base_elt; - iib_link_set_entry_t *ls_elt, *ls_tmp; + iib_base_entry_t *base_elt = NULL; + iib_link_set_entry_t *ls_elt = NULL, *ls_tmp = NULL; LL_FOREACH(iib_base_entry_head, base_elt) { LL_FOREACH_SAFE(base_elt->link_set_head, ls_elt, ls_tmp) { @@ -226,8 +226,8 @@ void iib_update_lt_status(timex_t *now) void iib_propagate_nb_entry_change(nib_entry_t *old_entry, nib_entry_t *new_entry) { - iib_base_entry_t *base_elt; - iib_link_set_entry_t *ls_elt; + iib_base_entry_t *base_elt = NULL; + iib_link_set_entry_t *ls_elt = NULL; LL_FOREACH(iib_base_entry_head, base_elt) { LL_FOREACH(base_elt->link_set_head, ls_elt) { if (ls_elt->nb_elt == old_entry) { @@ -314,7 +314,7 @@ void iib_process_metric_pckt(iib_link_set_entry_t *ls_entry, uint32_t metric_out } else if (ls_entry->metric_out == ls_entry->nb_elt->metric_out){ /* The corresponding neighbor tuples metric needs to be updated */ - iib_base_entry_t *base_elt; + iib_base_entry_t *base_elt = NULL; iib_link_set_entry_t *ls_elt; ls_entry->nb_elt->metric_out = metric_out; LL_FOREACH(iib_base_entry_head, base_elt) { @@ -364,15 +364,15 @@ void iib_process_metric_refresh(void) */ static void cleanup_link_sets(void) { - iib_base_entry_t *base_elt; + iib_base_entry_t *base_elt = NULL; /* Loop through all link sets */ LL_FOREACH(iib_base_entry_head, base_elt) { /* Loop through all link tuples of the link set */ - iib_link_set_entry_t *ls_elt, *ls_tmp; + iib_link_set_entry_t *ls_elt = NULL, *ls_tmp = NULL; LL_FOREACH_SAFE(base_elt->link_set_head, ls_elt, ls_tmp) { /* Loop through all addresses of the link tuples */ - nhdp_addr_entry_t *lt_elt, *lt_tmp; + nhdp_addr_entry_t *lt_elt = NULL, *lt_tmp = NULL; LL_FOREACH_SAFE(ls_elt->address_list_head, lt_elt, lt_tmp) { if (NHDP_ADDR_TMP_IN_REM_LIST(lt_elt->address)) { /* Remove link tuple address if included in the Removed Addr List */ @@ -385,7 +385,7 @@ static void cleanup_link_sets(void) if (!ls_elt->address_list_head) { if (ls_elt->last_status == IIB_LT_STATUS_SYM) { /* Remove all two hop entries for the corresponding link tuple */ - iib_two_hop_set_entry_t *th_elt, *th_tmp; + iib_two_hop_set_entry_t *th_elt = NULL, *th_tmp = NULL; LL_FOREACH_SAFE(base_elt->two_hop_set_head, th_elt, th_tmp) { if (th_elt->ls_elt == ls_elt) { rem_two_hop_entry(base_elt, th_elt); @@ -406,9 +406,9 @@ static iib_link_set_entry_t *update_link_set(iib_base_entry_t *base_entry, nib_e timex_t *now, uint64_t val_time, uint8_t sym, uint8_t lost) { - iib_link_set_entry_t *ls_elt, *ls_tmp; + iib_link_set_entry_t *ls_elt = NULL, *ls_tmp = NULL; iib_link_set_entry_t *matching_lt = NULL; - nhdp_addr_entry_t *lt_elt; + nhdp_addr_entry_t *lt_elt = NULL; timex_t v_time, l_hold; uint8_t matches = 0; @@ -643,8 +643,8 @@ static int update_two_hop_set(iib_base_entry_t *base_entry, iib_link_set_entry_t /* If the link to the neighbor is still symmetric */ if (get_tuple_status(ls_entry, now) == IIB_LT_STATUS_SYM) { - iib_two_hop_set_entry_t *ths_elt, *ths_tmp; - nhdp_addr_t *addr_elt; + iib_two_hop_set_entry_t *ths_elt = NULL, *ths_tmp = NULL; + nhdp_addr_t *addr_elt = NULL; /* Loop through all the two hop tuples of the two hop set */ LL_FOREACH_SAFE(base_entry->two_hop_set_head, ths_elt, ths_tmp) { @@ -728,7 +728,7 @@ static void rem_two_hop_entry(iib_base_entry_t *base_entry, iib_two_hop_set_entr static void update_nb_tuple_symmetry(iib_base_entry_t *base_entry, iib_link_set_entry_t *ls_entry, timex_t *now) { - iib_two_hop_set_entry_t *th_elt, *th_tmp; + iib_two_hop_set_entry_t *th_elt = NULL, *th_tmp = NULL; /* First remove all two hop entries for the corresponding link tuple */ LL_FOREACH_SAFE(base_entry->two_hop_set_head, th_elt, th_tmp) { @@ -739,9 +739,9 @@ static void update_nb_tuple_symmetry(iib_base_entry_t *base_entry, /* Afterwards check the neighbor tuple containing the link tuple's addresses */ if ((ls_entry->nb_elt != NULL) && (ls_entry->nb_elt->symmetric == 1)) { - iib_base_entry_t *base_tmp; + iib_base_entry_t *base_tmp = NULL; LL_FOREACH(iib_base_entry_head, base_tmp) { - iib_link_set_entry_t *ls_tmp; + iib_link_set_entry_t *ls_tmp = NULL; LL_FOREACH(base_tmp->link_set_head, ls_tmp) { if ((ls_entry->nb_elt == ls_tmp->nb_elt) && (ls_entry != ls_tmp)) { if (timex_cmp(ls_tmp->sym_time, *now) == 1) { @@ -764,9 +764,9 @@ static void rem_not_heard_nb_tuple(iib_link_set_entry_t *ls_entry, timex_t *now) { /* Check whether the corresponding neighbor tuple still exists */ if (ls_entry->nb_elt) { - iib_base_entry_t *base_tmp; + iib_base_entry_t *base_tmp = NULL; LL_FOREACH(iib_base_entry_head, base_tmp) { - iib_link_set_entry_t *ls_tmp; + iib_link_set_entry_t *ls_tmp = NULL; LL_FOREACH(base_tmp->link_set_head, ls_tmp) { if ((ls_entry->nb_elt == ls_tmp->nb_elt) && (ls_entry != ls_tmp)) { if (timex_cmp(ls_tmp->heard_time, *now) == 1) { @@ -855,7 +855,7 @@ static void queue_rem(uint8_t *queue) */ static void dat_metric_refresh(void) { - iib_base_entry_t *base_elt; + iib_base_entry_t *base_elt = NULL; iib_link_set_entry_t *ls_elt; uint32_t metric_temp; double sum_total, sum_rcvd, loss; diff --git a/sys/net/routing/nhdp/lib_table.c b/sys/net/routing/nhdp/lib_table.c index 401384a1979b..1f4a3cf9d9d2 100644 --- a/sys/net/routing/nhdp/lib_table.c +++ b/sys/net/routing/nhdp/lib_table.c @@ -44,8 +44,8 @@ static int add_address_to_if(lib_entry_t *if_entry, nhdp_addr_t *addr); int lib_add_if_addr(kernel_pid_t if_pid, nhdp_addr_t *addr) { - lib_entry_t *lib_elt; - nhdp_addr_entry_t *addr_elt; + lib_entry_t *lib_elt = NULL; + nhdp_addr_entry_t *addr_elt = NULL; int result = -1; mutex_lock(&mtx_lib_access); @@ -81,7 +81,7 @@ int lib_add_if_addr(kernel_pid_t if_pid, nhdp_addr_t *addr) void lib_rem_if(kernel_pid_t if_pid) { - lib_entry_t *lib_elt, *lib_tmp; + lib_entry_t *lib_elt = NULL, *lib_tmp = NULL; mutex_lock(&mtx_lib_access); @@ -99,8 +99,8 @@ void lib_rem_if(kernel_pid_t if_pid) void lib_fill_wr_addresses(kernel_pid_t if_pid, struct rfc5444_writer *wr) { - lib_entry_t *lib_elt; - nhdp_addr_entry_t *add_tmp; + lib_entry_t *lib_elt = NULL; + nhdp_addr_entry_t *add_tmp = NULL; mutex_lock(&mtx_lib_access); @@ -138,8 +138,8 @@ void lib_fill_wr_addresses(kernel_pid_t if_pid, struct rfc5444_writer *wr) uint8_t lib_is_reg_addr(kernel_pid_t if_pid, nhdp_addr_t *addr) { - lib_entry_t *lib_elt; - nhdp_addr_entry_t *addr_elt; + lib_entry_t *lib_elt = NULL; + nhdp_addr_entry_t *addr_elt = NULL; LL_FOREACH(lib_entry_head, lib_elt) { LL_FOREACH(lib_elt->if_addr_list_head, addr_elt) { diff --git a/sys/net/routing/nhdp/nhdp_address.c b/sys/net/routing/nhdp/nhdp_address.c index de9f70f51226..c21bcc4ee87f 100644 --- a/sys/net/routing/nhdp/nhdp_address.c +++ b/sys/net/routing/nhdp/nhdp_address.c @@ -35,7 +35,7 @@ static nhdp_addr_t *nhdp_addr_db_head = NULL; nhdp_addr_t *nhdp_addr_db_get_address(uint8_t *addr, size_t addr_size, uint8_t addr_type) { - nhdp_addr_t *addr_elt; + nhdp_addr_t *addr_elt = NULL; mutex_lock(&mtx_addr_access); @@ -101,7 +101,7 @@ void nhdp_decrement_addr_usage(nhdp_addr_t *addr) void nhdp_free_addr_list(nhdp_addr_entry_t *list_head) { - nhdp_addr_entry_t *list_elt, *list_tmp; + nhdp_addr_entry_t *list_elt = NULL, *list_tmp = NULL; LL_FOREACH_SAFE(list_head, list_elt, list_tmp) { nhdp_free_addr_entry(list_elt); @@ -117,7 +117,7 @@ void nhdp_free_addr_entry(nhdp_addr_entry_t *addr_entry) nhdp_addr_entry_t *nhdp_generate_addr_list_from_tmp(uint8_t tmp_type) { nhdp_addr_entry_t *new_list_head; - nhdp_addr_t *addr_elt; + nhdp_addr_t *addr_elt = NULL; new_list_head = NULL; LL_FOREACH(nhdp_addr_db_head, addr_elt) { @@ -142,7 +142,7 @@ nhdp_addr_entry_t *nhdp_generate_addr_list_from_tmp(uint8_t tmp_type) void nhdp_reset_addresses_tmp_usg(uint8_t decr_usg) { - nhdp_addr_t *addr_elt, *addr_tmp; + nhdp_addr_t *addr_elt = NULL, *addr_tmp = NULL; LL_FOREACH_SAFE(nhdp_addr_db_head, addr_elt, addr_tmp) { addr_elt->tmp_metric_val = NHDP_METRIC_UNKNOWN; diff --git a/sys/net/routing/nhdp/nib_table.c b/sys/net/routing/nhdp/nib_table.c index f266936d5482..615b7dba40ac 100644 --- a/sys/net/routing/nhdp/nib_table.c +++ b/sys/net/routing/nhdp/nib_table.c @@ -51,7 +51,7 @@ static void rem_ln_entry(nib_lost_address_entry_t *ln_entry); nib_entry_t *nib_process_hello(void) { nib_entry_t *nb_match = NULL; - nib_entry_t *nib_elt, *nib_tmp; + nib_entry_t *nib_elt = NULL, *nib_tmp = NULL; timex_t now; uint8_t matches = 0; @@ -60,7 +60,7 @@ nib_entry_t *nib_process_hello(void) xtimer_now_timex(&now); LL_FOREACH_SAFE(nib_entry_head, nib_elt, nib_tmp) { - nhdp_addr_entry_t *list_elt; + nhdp_addr_entry_t *list_elt = NULL; LL_FOREACH(nib_elt->address_list_head, list_elt) { if (NHDP_ADDR_TMP_IN_NB_LIST(list_elt->address)) { /* Matching neighbor tuple */ @@ -106,9 +106,9 @@ nib_entry_t *nib_process_hello(void) void nib_fill_wr_addresses(struct rfc5444_writer *wr) { - nib_entry_t *nib_elt; - nhdp_addr_entry_t *addr_elt; - nib_lost_address_entry_t *lost_elt, *lost_tmp; + nib_entry_t *nib_elt = NULL; + nhdp_addr_entry_t *addr_elt = NULL; + nib_lost_address_entry_t *lost_elt = NULL, *lost_tmp = NULL; timex_t now; mutex_lock(&mtx_nib_access); @@ -160,8 +160,8 @@ void nib_rem_nb_entry(nib_entry_t *nib_entry) void nib_set_nb_entry_sym(nib_entry_t *nib_entry) { - nib_lost_address_entry_t *ln_elt, *ln_tmp; - nhdp_addr_entry_t *nb_elt; + nib_lost_address_entry_t *ln_elt = NULL, *ln_tmp = NULL; + nhdp_addr_entry_t *nb_elt = NULL; nib_entry->symmetric = 1; LL_FOREACH(nib_entry->address_list_head, nb_elt) { @@ -177,7 +177,7 @@ void nib_set_nb_entry_sym(nib_entry_t *nib_entry) void nib_reset_nb_entry_sym(nib_entry_t *nib_entry, timex_t *now) { - nhdp_addr_entry_t *nb_elt; + nhdp_addr_entry_t *nb_elt = NULL; nib_entry->symmetric = 0; LL_FOREACH(nib_entry->address_list_head, nb_elt) { @@ -241,7 +241,7 @@ static void rem_nib_entry(nib_entry_t *nib_entry, timex_t *now) */ static void clear_nb_addresses(nib_entry_t *nib_entry, timex_t *now) { - nhdp_addr_entry_t *nib_elt, *nib_tmp; + nhdp_addr_entry_t *nib_elt = NULL, *nib_tmp = NULL;; LL_FOREACH_SAFE(nib_entry->address_list_head, nib_elt, nib_tmp) { /* Check whether address is still present in the new neighbor address list */ @@ -269,7 +269,7 @@ static void clear_nb_addresses(nib_entry_t *nib_entry, timex_t *now) */ static int add_lost_neighbor_address(nhdp_addr_t *lost_addr, timex_t *now) { - nib_lost_address_entry_t *elt; + nib_lost_address_entry_t *elt = NULL; timex_t n_hold = timex_from_uint64(((uint64_t)NHDP_N_HOLD_TIME_MS) * US_PER_MS); LL_FOREACH(nib_lost_address_entry_head, elt) { diff --git a/sys/random/fortuna/fortuna.c b/sys/random/fortuna/fortuna.c index f1d801dd26ef..1e3f19721913 100755 --- a/sys/random/fortuna/fortuna.c +++ b/sys/random/fortuna/fortuna.c @@ -184,7 +184,7 @@ int fortuna_random_data(fortuna_state_t *state, uint8_t *out, size_t bytes) size_t len = 0; for (int i = 0; i < (int) FORTUNA_POOLS; i++) { - if (state->reseeds | (1 << i)) { + if (state->reseeds | ((uint32_t)1 << i)) { sha256_final(&state->pools[i].ctx, &buf[len]); sha256_init(&state->pools[i].ctx); state->pools[i].len = 0; diff --git a/sys/shell/commands/sc_gnrc_rpl.c b/sys/shell/commands/sc_gnrc_rpl.c index c41fc07d6c8e..284a6745d838 100644 --- a/sys/shell/commands/sc_gnrc_rpl.c +++ b/sys/shell/commands/sc_gnrc_rpl.c @@ -314,7 +314,7 @@ int _gnrc_rpl_dodag_show(void) } #endif - gnrc_rpl_parent_t *parent; + gnrc_rpl_parent_t *parent = NULL; LL_FOREACH(gnrc_rpl_instances[i].dodag.parents, parent) { printf("\t\tparent [addr: %s | rank: %d]\n", ipv6_addr_to_str(addr_str, &parent->addr, sizeof(addr_str)),