[RESEND] edac: replace sprintf() by scnprintf()

From: Salah Triki
Date: Sat Jul 10 2021 - 12:35:21 EST


Replace sprintf() by scnprintf() in order to avoid buffer overflows.

Signed-off-by: Salah Triki <salah.triki@xxxxxxxxx>
---
drivers/edac/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/debugfs.c b/drivers/edac/debugfs.c
index 4804332d9946..c83653084aa3 100644
--- a/drivers/edac/debugfs.c
+++ b/drivers/edac/debugfs.c
@@ -61,7 +61,7 @@ void edac_create_debugfs_nodes(struct mem_ctl_info *mci)
parent = debugfs_create_dir(mci->dev.kobj.name, edac_debugfs);

for (i = 0; i < mci->n_layers; i++) {
- sprintf(name, "fake_inject_%s",
+ scnprintf(name, sizeof(name), "fake_inject_%s",
edac_layer_name[mci->layers[i].type]);
debugfs_create_u8(name, S_IRUGO | S_IWUSR, parent,
&mci->fake_inject_layer[i]);
--
2.25.1