LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Salah Triki <salah.triki@gmail.com>
To: bp@alien8.de, mchehab@kernel.org, tony.luck@intel.com,
	james.morse@arm.com, rric@kernel.org
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RESEND] edac: replace sprintf() by scnprintf()
Date: Sat, 10 Jul 2021 17:35:05 +0100	[thread overview]
Message-ID: <20210710163505.GA689509@pc> (raw)

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

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 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


             reply	other threads:[~2021-07-10 16:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-10 16:35 Salah Triki [this message]
2021-07-10 16:58 ` Joe Perches
2021-07-12 12:09   ` Salah Triki
2021-07-12 16:30     ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210710163505.GA689509@pc \
    --to=salah.triki@gmail.com \
    --cc=bp@alien8.de \
    --cc=james.morse@arm.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rric@kernel.org \
    --cc=tony.luck@intel.com \
    --subject='Re: [RESEND] edac: replace sprintf() by scnprintf()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).