From 93f6700be744091498ed7000f2580903fd04f100 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Thu, 24 May 2018 19:09:23 +0800 Subject: [PATCH 1/5] newlib: fix errors for GCC 8 support components/newlib/include/sys/reent.h:405:11: error: unnecessary parentheses in declaration of '_sig_func' [-Werror=parentheses] void (**(_sig_func))(int); ^ --- components/newlib/include/sys/reent.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/newlib/include/sys/reent.h b/components/newlib/include/sys/reent.h index ee40961894..b35595a7d4 100644 --- a/components/newlib/include/sys/reent.h +++ b/components/newlib/include/sys/reent.h @@ -402,7 +402,7 @@ struct _reent char *_asctime_buf; /* signal info */ - void (**(_sig_func))(int); + void (**_sig_func)(int); # ifndef _REENT_GLOBAL_ATEXIT /* atexit stuff */ From 2a810a318fd1cf2e5768dfe4baf8dbe368be3fd7 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Thu, 24 May 2018 19:09:23 +0800 Subject: [PATCH 2/5] ipc: fix errors for GCC 8 support components/esp32/ipc.c: In function 'esp_ipc_init': components/esp32/ipc.c:82:31: error: '%d' directive writing between 1 and 11 bytes into a region of size 5 [-Werror=format-overflow=] sprintf(task_name,"ipc%d",i); ^~ components/esp32/ipc.c:82:27: note: directive argument in the range [-2147483648, 1] sprintf(task_name,"ipc%d",i); ^~~~~~~ components/esp32/ipc.c:82:9: note: 'sprintf' output between 5 and 15 bytes into a destination of size 8 sprintf(task_name,"ipc%d",i); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- components/esp32/ipc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp32/ipc.c b/components/esp32/ipc.c index aedf4edb3b..6319a621d7 100644 --- a/components/esp32/ipc.c +++ b/components/esp32/ipc.c @@ -77,7 +77,7 @@ void esp_ipc_init() { s_ipc_mutex = xSemaphoreCreateMutex(); s_ipc_ack = xSemaphoreCreateBinary(); - char task_name[8]; + char task_name[15]; for (int i = 0; i < portNUM_PROCESSORS; ++i) { sprintf(task_name,"ipc%d",i); s_ipc_sem[i] = xSemaphoreCreateBinary(); From 714a9bda92009717b4a34045b4300074195e1fe2 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Thu, 24 May 2018 19:29:33 +0800 Subject: [PATCH 3/5] fatfs: fix errors for GCC 8 support and some indentation components/fatfs/src/ff.c: In function 'f_fdisk': components/fatfs/src/ff.c:5995:5: error: this 'for' clause does not guard... [-Werror=misleading-indentation] for (n = 16; n < 256 && sz_disk / n / cluster_size > 1024; n *= 2) ; ^~~ components/fatfs/src/ff.c:5996:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for' if (n == 256) n--; ^~ --- components/fatfs/src/ff.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/components/fatfs/src/ff.c b/components/fatfs/src/ff.c index 4225a044ce..b87b9b4303 100644 --- a/components/fatfs/src/ff.c +++ b/components/fatfs/src/ff.c @@ -2236,7 +2236,7 @@ void init_alloc_info ( /* exFAT: Load the object's directory entry block */ /*------------------------------------------------*/ static -FRESULT load_obj_xdir ( +FRESULT load_obj_xdir ( FF_DIR* dp, /* Blank directory object to be used to access containing direcotry */ const FFOBJID* obj /* Object with its containing directory information */ ) @@ -5975,7 +5975,7 @@ FRESULT f_fdisk ( BYTE s_hd, e_hd, *p, *buf = (BYTE*)work; DSTATUS stat; DWORD sz_disk, sz_part, s_part; - DWORD cluster_size = CLUSTER_SIZE; + DWORD cluster_size = CLUSTER_SIZE; FRESULT res; @@ -5991,14 +5991,17 @@ FRESULT f_fdisk ( if (!buf) return FR_NOT_ENOUGH_CORE; /* Determine the CHS without any consideration of the drive geometry */ - for (n = 16; n < 256 && sz_disk / n / cluster_size > 1024; n *= 2) ; + for (n = 16; n < 256 && sz_disk / n / cluster_size > 1024; n *= 2) + { + ; + } if (n == 256) n--; - if (sz_disk < SUPPORTED_FLASH_SIZE) { - cluster_size = 1; - n = sz_disk; - } + if (sz_disk < SUPPORTED_FLASH_SIZE) { + cluster_size = 1; + n = sz_disk; + } e_hd = n - 1; - sz_cyl = cluster_size * n; + sz_cyl = cluster_size * n; tot_cyl = sz_disk / sz_cyl; /* Create partition table */ @@ -6011,7 +6014,7 @@ FRESULT f_fdisk ( sz_part = (DWORD)sz_cyl * p_cyl; if (i == 0) { /* Exclude first track of cylinder 0 */ s_hd = 1; - s_part += cluster_size; sz_part -= cluster_size; + s_part += cluster_size; sz_part -= cluster_size; } else { s_hd = 0; } From f42b91fe46789c46445ba2841c31a9fa1f354ca0 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Thu, 24 May 2018 19:32:34 +0800 Subject: [PATCH 4/5] spi_flash: fix errors for GCC 8 support components/spi_flash/partition.c: In function 'load_partitions': components/spi_flash/partition.c:179:66: error: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess] strncpy(item->info.label, (const char*) it->label, sizeof(it->label)); ^ --- components/bootloader_support/src/bootloader_common.c | 2 +- components/spi_flash/partition.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bootloader_support/src/bootloader_common.c b/components/bootloader_support/src/bootloader_common.c index 98e5606ede..12f60e9ce1 100644 --- a/components/bootloader_support/src/bootloader_common.c +++ b/components/bootloader_support/src/bootloader_common.c @@ -134,7 +134,7 @@ bool bootloader_common_erase_part_type_data(const char *list_erase, bool ota_dat fl_ota_data_erase = true; } // partition->label is not null-terminated string. - strncpy(label, (char *)&partition->label, sizeof(partition->label)); + strncpy(label, (char *)&partition->label, sizeof(label) - 1); if (fl_ota_data_erase == true || (bootloader_common_label_search(list_erase, label) == true)) { err = esp_rom_spiflash_erase_area(partition->pos.offset, partition->pos.size); if (err != ESP_OK) { diff --git a/components/spi_flash/partition.c b/components/spi_flash/partition.c index 4003291999..7f63d4c343 100644 --- a/components/spi_flash/partition.c +++ b/components/spi_flash/partition.c @@ -176,7 +176,7 @@ static esp_err_t load_partitions() } // it->label may not be zero-terminated - strncpy(item->info.label, (const char*) it->label, sizeof(it->label)); + strncpy(item->info.label, (const char*) it->label, sizeof(item->info.label) - 1); item->info.label[sizeof(it->label)] = 0; // add it to the list if (last == NULL) { From 1f3320ebdf71887ff2a0a407b738bb0a713972a3 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Tue, 29 May 2018 15:36:43 +0800 Subject: [PATCH 5/5] wpa_supplicant: fix errors for GCC 8 support components/wpa_supplicant/port/include/os.h:259:29: error: 'strncpy' output truncated before terminating nul copying 3 bytes from a string of the same length [-Werror=stringop-truncation] #define os_strncpy(d, s, n) strncpy((d), (s), (n)) ^~~~~~~~~~~~~~~~~~~~~~ components/wpa_supplicant/src/wpa2/eap_peer/eap.c:410:3: note: in expansion of macro 'os_strncpy' os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN); ^~~~~~~~~~ --- components/wpa_supplicant/src/wpa2/eap_peer/eap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/wpa_supplicant/src/wpa2/eap_peer/eap.c b/components/wpa_supplicant/src/wpa2/eap_peer/eap.c index 865da65470..10fc2257bd 100644 --- a/components/wpa_supplicant/src/wpa2/eap_peer/eap.c +++ b/components/wpa_supplicant/src/wpa2/eap_peer/eap.c @@ -407,7 +407,7 @@ int eap_peer_blob_init(struct eap_sm *sm) ret = -2; goto _out; } - os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN); + os_strncpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN+1); sm->blob[0].len = g_wpa_client_cert_len; sm->blob[0].data = g_wpa_client_cert; } @@ -418,7 +418,7 @@ int eap_peer_blob_init(struct eap_sm *sm) ret = -2; goto _out; } - os_strncpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN); + os_strncpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN+1); sm->blob[1].len = g_wpa_private_key_len; sm->blob[1].data = g_wpa_private_key; } @@ -429,7 +429,7 @@ int eap_peer_blob_init(struct eap_sm *sm) ret = -2; goto _out; } - os_strncpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN); + os_strncpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN+1); sm->blob[2].len = g_wpa_ca_cert_len; sm->blob[2].data = g_wpa_ca_cert; }