mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Thorsten Blum <thorsten.blum@linux.dev>
Cc: linux-hardening@vger.kernel.org, linux-mips@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 7/8] MIPS: octeon: Replace deprecated strcpy() in octeon_model_get_string_buffer()
Date: Sun, 17 Aug 2025 20:37:17 +0200	[thread overview]
Message-ID: <20250817183728.612012-7-thorsten.blum@linux.dev> (raw)
In-Reply-To: <20250817183728.612012-1-thorsten.blum@linux.dev>

strcpy() is deprecated; use strscpy() instead.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 .../cavium-octeon/executive/octeon-model.c    | 31 ++++++++++---------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/arch/mips/cavium-octeon/executive/octeon-model.c b/arch/mips/cavium-octeon/executive/octeon-model.c
index 657dbad9644e..98996cc0857e 100644
--- a/arch/mips/cavium-octeon/executive/octeon-model.c
+++ b/arch/mips/cavium-octeon/executive/octeon-model.c
@@ -25,6 +25,7 @@
  * Contact Cavium Networks for more information
  ***********************license end**************************************/
 
+#include <linux/string.h>
 #include <asm/octeon/octeon.h>
 
 enum octeon_feature_bits __octeon_feature_bits __read_mostly;
@@ -208,16 +209,16 @@ static const char *__init octeon_model_get_string_buffer(uint32_t chip_id,
 		 */
 		switch (chip_id & 0xf) {
 		case 0:
-			strcpy(pass, "1.X");
+			strscpy(pass, "1.X");
 			break;
 		case 1:
-			strcpy(pass, "2.X");
+			strscpy(pass, "2.X");
 			break;
 		case 3:
-			strcpy(pass, "3.X");
+			strscpy(pass, "3.X");
 			break;
 		default:
-			strcpy(pass, "X.X");
+			strscpy(pass, "X.X");
 			break;
 		}
 		break;
@@ -232,13 +233,13 @@ static const char *__init octeon_model_get_string_buffer(uint32_t chip_id,
 		 */
 		switch (chip_id & 0xf) {
 		case 0:
-			strcpy(pass, "1.0");
+			strscpy(pass, "1.0");
 			break;
 		case 2:
-			strcpy(pass, "1.1");
+			strscpy(pass, "1.1");
 			break;
 		default:
-			strcpy(pass, "X.X");
+			strscpy(pass, "X.X");
 			break;
 		}
 		break;
@@ -253,13 +254,13 @@ static const char *__init octeon_model_get_string_buffer(uint32_t chip_id,
 		 */
 		switch (chip_id & 0xf) {
 		case 0:
-			strcpy(pass, "1.0");
+			strscpy(pass, "1.0");
 			break;
 		case 2:
-			strcpy(pass, "1.1");
+			strscpy(pass, "1.1");
 			break;
 		default:
-			strcpy(pass, "X.X");
+			strscpy(pass, "X.X");
 			break;
 		}
 		break;
@@ -273,16 +274,16 @@ static const char *__init octeon_model_get_string_buffer(uint32_t chip_id,
 		if ((chip_id & 0xFF) < 0x8) {
 			switch (chip_id & 0x3) {
 			case 0:
-				strcpy(pass, "1.0");
+				strscpy(pass, "1.0");
 				break;
 			case 1:
-				strcpy(pass, "1.1");
+				strscpy(pass, "1.1");
 				break;
 			case 3:
-				strcpy(pass, "1.2");
+				strscpy(pass, "1.2");
 				break;
 			default:
-				strcpy(pass, "1.X");
+				strscpy(pass, "1.X");
 				break;
 			}
 		}
@@ -447,7 +448,7 @@ static const char *__init octeon_model_get_string_buffer(uint32_t chip_id,
 	default:
 		family = "XX";
 		core_model = "XX";
-		strcpy(pass, "X.X");
+		strscpy(pass, "X.X");
 		suffix = "XXX";
 		break;
 	}
-- 
2.50.1


  parent reply	other threads:[~2025-08-17 18:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-17 18:37 [PATCH 1/8] MIPS: sgi-ip22: Replace deprecated strcpy() in plat_mem_setup() Thorsten Blum
2025-08-17 18:37 ` [PATCH 2/8] MIPS: sgi-ip32: " Thorsten Blum
2025-08-18 23:40   ` Justin Stitt
2025-08-19  0:33     ` Thorsten Blum
2025-08-29 10:25   ` Thomas Bogendoerfer
2025-08-17 18:37 ` [PATCH 3/8] MIPS: sni: Replace deprecated strcpy() in sni_console_setup() Thorsten Blum
2025-08-18 23:45   ` Justin Stitt
2025-08-29 10:25   ` Thomas Bogendoerfer
2025-08-17 18:37 ` [PATCH 4/8] MIPS: txx9: Replace deprecated strcpy() with strscpy() Thorsten Blum
2025-08-18  6:30   ` Geert Uytterhoeven
2025-08-29 10:25   ` Thomas Bogendoerfer
2025-08-17 18:37 ` [PATCH 5/8] MIPS: arc: Replace deprecated strcpy() with memcpy() Thorsten Blum
2025-08-18 23:58   ` Justin Stitt
2025-08-19 10:00     ` Thorsten Blum
2025-08-29 10:26   ` Thomas Bogendoerfer
2025-08-17 18:37 ` [PATCH 6/8] MIPS: octeon: Replace memset(0) + deprecated strcpy() with strscpy_pad() Thorsten Blum
2025-08-19  0:02   ` Justin Stitt
2025-08-29 10:26   ` Thomas Bogendoerfer
2025-08-17 18:37 ` Thorsten Blum [this message]
2025-08-29 10:26   ` [PATCH 7/8] MIPS: octeon: Replace deprecated strcpy() in octeon_model_get_string_buffer() Thomas Bogendoerfer
2025-08-17 18:37 ` [PATCH 8/8] MIPS: generic: Replace deprecated strcpy() in ocelot_detect() Thorsten Blum
2025-08-29 10:27   ` Thomas Bogendoerfer
2025-08-18 23:24 ` [PATCH 1/8] MIPS: sgi-ip22: Replace deprecated strcpy() in plat_mem_setup() Justin Stitt
2025-08-29 10:25 ` Thomas Bogendoerfer

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=20250817183728.612012-7-thorsten.blum@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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 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®