[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 23/27] hw/misc/imx: Replace sprintf() by snprintf()
|
From: |
Richard Henderson |
|
Subject: |
[PATCH v3 23/27] hw/misc/imx: Replace sprintf() by snprintf() |
|
Date: |
Fri, 12 Apr 2024 00:33:42 -0700 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience. Use snprintf() instead.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20240411104340.6617-6-philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/misc/imx25_ccm.c | 2 +-
hw/misc/imx31_ccm.c | 2 +-
hw/misc/imx6_ccm.c | 4 ++--
hw/misc/imx6_src.c | 2 +-
hw/misc/imx6ul_ccm.c | 4 ++--
hw/misc/imx7_src.c | 2 +-
hw/net/imx_fec.c | 2 +-
hw/ssi/imx_spi.c | 2 +-
8 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/misc/imx25_ccm.c b/hw/misc/imx25_ccm.c
index d888966014..faa726a86a 100644
--- a/hw/misc/imx25_ccm.c
+++ b/hw/misc/imx25_ccm.c
@@ -91,7 +91,7 @@ static const char *imx25_ccm_reg_name(uint32_t reg)
case IMX25_CCM_LPIMR1_REG:
return "lpimr1";
default:
- sprintf(unknown, "[%u ?]", reg);
+ snprintf(unknown, sizeof(unknown), "[%u ?]", reg);
return unknown;
}
}
diff --git a/hw/misc/imx31_ccm.c b/hw/misc/imx31_ccm.c
index a9059bb1f7..125d4fceeb 100644
--- a/hw/misc/imx31_ccm.c
+++ b/hw/misc/imx31_ccm.c
@@ -89,7 +89,7 @@ static const char *imx31_ccm_reg_name(uint32_t reg)
case IMX31_CCM_PDR2_REG:
return "PDR2";
default:
- sprintf(unknown, "[%u ?]", reg);
+ snprintf(unknown, sizeof(unknown), "[%u ?]", reg);
return unknown;
}
}
diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c
index 56489d8b57..b1def7f05b 100644
--- a/hw/misc/imx6_ccm.c
+++ b/hw/misc/imx6_ccm.c
@@ -85,7 +85,7 @@ static const char *imx6_ccm_reg_name(uint32_t reg)
case CCM_CMEOR:
return "CMEOR";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
@@ -224,7 +224,7 @@ static const char *imx6_analog_reg_name(uint32_t reg)
case USB_ANALOG_DIGPROG:
return "USB_ANALOG_DIGPROG";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
diff --git a/hw/misc/imx6_src.c b/hw/misc/imx6_src.c
index 0c6003559f..3766bdf561 100644
--- a/hw/misc/imx6_src.c
+++ b/hw/misc/imx6_src.c
@@ -68,7 +68,7 @@ static const char *imx6_src_reg_name(uint32_t reg)
case SRC_GPR10:
return "SRC_GPR10";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
diff --git a/hw/misc/imx6ul_ccm.c b/hw/misc/imx6ul_ccm.c
index bbc0be9921..0ac49ea34b 100644
--- a/hw/misc/imx6ul_ccm.c
+++ b/hw/misc/imx6ul_ccm.c
@@ -143,7 +143,7 @@ static const char *imx6ul_ccm_reg_name(uint32_t reg)
case CCM_CMEOR:
return "CMEOR";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
@@ -274,7 +274,7 @@ static const char *imx6ul_analog_reg_name(uint32_t reg)
case USB_ANALOG_DIGPROG:
return "USB_ANALOG_DIGPROG";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
diff --git a/hw/misc/imx7_src.c b/hw/misc/imx7_src.c
index b3725ff6e7..d19f0450d4 100644
--- a/hw/misc/imx7_src.c
+++ b/hw/misc/imx7_src.c
@@ -75,7 +75,7 @@ static const char *imx7_src_reg_name(uint32_t reg)
case SRC_GPR10:
return "SRC_GPR10";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index cee84af7ba..8c91d20d44 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -41,7 +41,7 @@
static const char *imx_default_reg_name(IMXFECState *s, uint32_t index)
{
static char tmp[20];
- sprintf(tmp, "index %d", index);
+ snprintf(tmp, sizeof(tmp), "index %d", index);
return tmp;
}
diff --git a/hw/ssi/imx_spi.c b/hw/ssi/imx_spi.c
index d8a7583ff3..12d897d306 100644
--- a/hw/ssi/imx_spi.c
+++ b/hw/ssi/imx_spi.c
@@ -53,7 +53,7 @@ static const char *imx_spi_reg_name(uint32_t reg)
case ECSPI_MSGDATA:
return "ECSPI_MSGDATA";
default:
- sprintf(unknown, "%u ?", reg);
+ snprintf(unknown, sizeof(unknown), "%u ?", reg);
return unknown;
}
}
--
2.34.1
- [PATCH v3 12/27] disas/m68k: Replace sprintf() by snprintf(), (continued)
- [PATCH v3 12/27] disas/m68k: Replace sprintf() by snprintf(), Richard Henderson, 2024/04/12
- [PATCH v3 13/27] disas/microblaze: Replace sprintf() by snprintf(), Richard Henderson, 2024/04/12
- [PATCH v3 15/27] target/microblaze: Re-indent print_insn_microblaze, Richard Henderson, 2024/04/12
- [PATCH v3 14/27] disas/microblaze: Split out print_immval_addr, Richard Henderson, 2024/04/12
- [PATCH v3 16/27] disas/microblaze: Merge op->name output into each fprintf, Richard Henderson, 2024/04/12
- [PATCH v3 11/27] backends/tpm: Use qemu_hexdump_line to avoid sprintf, Richard Henderson, 2024/04/12
- [PATCH v3 05/27] util/hexdump: Inline g_string_append_printf "%02x", Richard Henderson, 2024/04/12
- [PATCH v3 17/27] disas/microblaze: Print registers directly with PRIreg, Richard Henderson, 2024/04/12
- [PATCH v3 23/27] hw/misc/imx: Replace sprintf() by snprintf(),
Richard Henderson <=
- [PATCH v3 18/27] disas/microblaze: Print immediates directly with PRIimm, Richard Henderson, 2024/04/12
- [PATCH v3 26/27] target/arm: Replace sprintf() by snprintf(), Richard Henderson, 2024/04/12
- [PATCH v3 22/27] linux-user/flatload: Replace sprintf() by snprintf(), Richard Henderson, 2024/04/12
- [PATCH v3 21/27] disas/riscv: Use GString in format_inst, Richard Henderson, 2024/04/12
- [PATCH v3 25/27] hw/riscv/virt: Replace sprintf by g_strdup_printf, Richard Henderson, 2024/04/12
- [PATCH v3 19/27] disas/microblaze: Print registers directly with PRIrfsl, Richard Henderson, 2024/04/12
- [PATCH v3 20/27] disas/microblaze: Split get_field_special, Richard Henderson, 2024/04/12
- [PATCH v3 24/27] hw/net/rocker: Replace sprintf() by snprintf(), Richard Henderson, 2024/04/12