Skip to content

Commit 083aad9

Browse files
committed
Merge branch 'fix/coredump-gcc-analyzer-warnings_v5.3' into 'release/v5.3'
fix(system): fix GCC-14 analyzer warnings for coredump (v5.3) See merge request espressif/esp-idf!35522
2 parents 9d3917d + 8bfabe7 commit 083aad9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

components/esp_system/panic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static inline void disable_all_wdts(void)
221221
wdt_hal_write_protect_enable(&wdt0_context);
222222

223223
#if SOC_TIMER_GROUPS >= 2
224-
//Interupt WDT is the Main Watchdog Timer of Timer Group 1
224+
//Interrupt WDT is the Main Watchdog Timer of Timer Group 1
225225
wdt_hal_write_protect_disable(&wdt1_context);
226226
wdt_hal_disable(&wdt1_context);
227227
wdt_hal_write_protect_enable(&wdt1_context);
@@ -299,7 +299,7 @@ void esp_panic_handler(panic_info_t *info)
299299
char *panic_reason_str = NULL;
300300
if (info->pseudo_excause) {
301301
panic_reason_str = (char *)info->reason;
302-
} else if (g_panic_abort && strlen(g_panic_abort_details)) {
302+
} else if (g_panic_abort) {
303303
panic_reason_str = g_panic_abort_details;
304304
}
305305
if (panic_reason_str) {

components/espcoredump/src/core_dump_elf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static int elf_write_note_header(core_dump_elf_t *self,
209209
elf_note note_hdr = { 0 };
210210

211211
memcpy(name_buffer, name, name_len);
212-
note_hdr.n_namesz = ALIGN_UP(name_len, 4);
212+
note_hdr.n_namesz = ALIGN_UP(name_len + 1, 4);
213213
note_hdr.n_descsz = data_sz;
214214
note_hdr.n_type = type;
215215
// write note header
@@ -242,7 +242,7 @@ static int elf_write_note(core_dump_elf_t *self,
242242
// write segment data during second pass
243243
if (self->elf_stage == ELF_STAGE_PLACE_DATA) {
244244
ELF_CHECK_ERR(data, ELF_PROC_ERR_OTHER, "Invalid data pointer %x.", (uint32_t)data);
245-
err = elf_write_note_header(self, name, name_len, data_sz, type);
245+
err = elf_write_note_header(self, name, strlen(name), data_sz, type);
246246
if (err != ESP_OK) {
247247
return err;
248248
}
@@ -688,7 +688,7 @@ static void elf_write_core_dump_note_cb(void *opaque, const char *data)
688688

689689
static int elf_add_wdt_panic_details(core_dump_elf_t *self)
690690
{
691-
uint32_t name_len = sizeof(ELF_ESP_CORE_DUMP_PANIC_DETAILS_NOTE_NAME);
691+
uint32_t name_len = sizeof(ELF_ESP_CORE_DUMP_PANIC_DETAILS_NOTE_NAME) - 1;
692692
core_dump_elf_opaque_t param = {
693693
.self = self,
694694
.total_size = 0,

components/espcoredump/src/core_dump_flash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static esp_err_t esp_core_dump_flash_write_data(core_dump_write_data_t* wr_data,
185185
wr_data->off += COREDUMP_CACHE_SIZE;
186186

187187
/* Update checksum with the newly written data on the flash. */
188-
esp_core_dump_checksum_update(&wr_data->checksum_ctx, &wr_data->cached_data, COREDUMP_CACHE_SIZE);
188+
esp_core_dump_checksum_update(&wr_data->checksum_ctx, wr_data->cached_data, COREDUMP_CACHE_SIZE);
189189

190190
/* Reset cache from the next use. */
191191
wr_data->cached_bytes = 0;

0 commit comments

Comments
 (0)