Fix error: '%d' directive writing between 1 and 10 bytes into a region of size 3

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-03-08 10:30:32 +08:00 committed by Petro Karashchenko
parent f1339ba479
commit 3b786a53cd
5 changed files with 10 additions and 10 deletions

View File

@ -101,7 +101,7 @@ int sam_smartfs_initialize(void)
const char *partstring = "256";
const char *ptr;
FAR struct mtd_dev_s *mtd_part;
char partref[4];
char partref[16];
/* Now create a partition on the FLASH device */
@ -160,7 +160,7 @@ int sam_smartfs_initialize(void)
*/
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
sprintf(partref, "p%d", partno);
snprintf(partref, sizeof(partref), "p%d", partno);
smart_initialize(0, mtd_part, partref);
#endif
}

View File

@ -220,7 +220,7 @@ int board_app_initialize(uintptr_t arg)
const char *partstring = CONFIG_MIKROE_FLASH_PART_LIST;
const char *ptr;
FAR struct mtd_dev_s *mtd_part;
char partname[4];
char partname[16];
/* Now create a partition on the FLASH device */
@ -254,7 +254,7 @@ int board_app_initialize(uintptr_t arg)
*/
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
sprintf(partname, "p%d", partno);
snprintf(partname, sizeof(partname), "p%d", partno);
smart_initialize(CONFIG_MIKROE_FLASH_MINOR, mtd_part,
partname);
#endif

View File

@ -148,7 +148,7 @@ int stm32_w25initialize(int minor)
const char *partstring = CONFIG_STM32F103MINIMUM_FLASH_PART_LIST;
const char *ptr;
FAR struct mtd_dev_s *mtd_part;
char partref[4];
char partref[16];
/* Now create a partition on the FLASH device */
@ -205,7 +205,7 @@ int stm32_w25initialize(int minor)
*/
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
sprintf(partref, "p%d", partno);
snprintf(partref, sizeof(partref), "p%d", partno);
smart_initialize(CONFIG_STM32F103MINIMUM_FLASH_MINOR,
mtd_part, partref);
#endif

View File

@ -169,7 +169,7 @@ int stm32_bringup(void)
const char *partstring = CONFIG_STM32F429I_DISCO_FLASH_PART_LIST;
const char *ptr;
FAR struct mtd_dev_s *mtd_part;
char partref[4];
char partref[16];
/* Now create a partition on the FLASH device */
@ -226,7 +226,7 @@ int stm32_bringup(void)
*/
#if defined(CONFIG_MTD_SMART) && defined(CONFIG_FS_SMARTFS)
sprintf(partref, "p%d", partno);
snprintf(partref, sizeof(partref), "p%d", partno);
smart_initialize(CONFIG_STM32F429I_DISCO_FLASH_MINOR,
mtd_part, partref);
#endif

View File

@ -125,7 +125,7 @@ int stm32l4_bringup(void)
FAR struct mtd_geometry_s geo;
const char *ptr = CONFIG_B_L475E_IOT01A_MTD_PART_LIST;
FAR struct mtd_dev_s *mtd_part;
char partref[4];
char partref[16];
/* Now create a partition on the FLASH device */
@ -182,7 +182,7 @@ int stm32l4_bringup(void)
* the MTD device
*/
sprintf(partref, "p%d", partno);
snprintf(partref, sizeof(partref), "p%d", partno);
smart_initialize(CONFIG_B_L475E_IOT01A_MTD_FLASH_MINOR,
mtd_part, partref);
#endif