mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] sparc: chmc: Use strscpy() for unknown DIMM labels
@ 2026-11-01 13:24 Thorsten Blum
  2026-11-01 13:24 ` [PATCH 2/2] sparc: chmc: Use buffer lengths when formatting " Thorsten Blum
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-11-01 13:24 UTC (permalink / raw)
  To: David S. Miller, Andreas Larsson; +Cc: Thorsten Blum, sparclinux, linux-kernel

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;
 	}
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-01 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01 13:24 [PATCH 1/2] sparc: chmc: Use strscpy() for unknown DIMM labels Thorsten Blum
2026-11-01 13:24 ` [PATCH 2/2] sparc: chmc: Use buffer lengths when formatting " Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®