All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <blum@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Andreas Larsson <andreas@gaisler.com>
Cc: Thorsten Blum <blum@kernel.org>,
	sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] sparc: chmc: Use strscpy() for unknown DIMM labels
Date: Sun,  1 Nov 2026 14:24:06 +0100	[thread overview]
Message-ID: <20261101132407.132460-3-blum@kernel.org> (raw)

Replace the manual writes of "???" in jbusmc_print_dimm() and
chmc_print_dimm() with strscpy() to simplify the code and to take the
buffer lengths into account.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/sparc/kernel/chmc.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index d935177b6953..ef31625272fa 100644
--- a/arch/sparc/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
@@ -304,10 +304,7 @@ static int jbusmc_print_dimm(int syndrome_code,
 	if (dp == NULL ||
 	    syndrome_code < SYNDROME_MIN ||
 	    syndrome_code > SYNDROME_MAX) {
-		buf[0] = '?';
-		buf[1] = '?';
-		buf[2] = '?';
-		buf[3] = '\0';
+		strscpy(buf, "???", buflen);
 		return 0;
 	}
 	p = dp->controller;
@@ -549,10 +546,7 @@ static int chmc_print_dimm(int syndrome_code,
 	if (bp == NULL ||
 	    syndrome_code < SYNDROME_MIN ||
 	    syndrome_code > SYNDROME_MAX) {
-		buf[0] = '?';
-		buf[1] = '?';
-		buf[2] = '?';
-		buf[3] = '\0';
+		strscpy(buf, "???", buflen);
 		return 0;
 	}
 

             reply	other threads:[~2026-11-01 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01 13:24 Thorsten Blum [this message]
2026-11-01 13:24 ` [PATCH 2/2] sparc: chmc: Use buffer lengths when formatting DIMM labels Thorsten Blum

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=20261101132407.132460-3-blum@kernel.org \
    --to=blum@kernel.org \
    --cc=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.