public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: buslogic: replace strcpy() with strscpy()
@ 2026-03-13 20:28 Atharv Dubey
  2026-03-19 14:43 ` Atharv Dubey
  0 siblings, 1 reply; 3+ messages in thread
From: Atharv Dubey @ 2026-03-13 20:28 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Khalid Aziz, James E.J. Bottomley,
	Martin K. Petersen
  Cc: linux-media, linux-kernel, linux-scsi, Atharv Dubey

strcpy() is deprecated as it does not perform bounds checking[1].
Using it can risk buffer overflows if the source string exceeds
the destination.

Replace occurrences of strcpy() with the safer strscpy() where
the size of buffer is being checked.

Compile tested.

[1] Documentation/process/deprecated.rst

Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
---
 drivers/scsi/BusLogic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index da6599ae3d0d..c070f3b8197e 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -1262,7 +1262,7 @@ static bool __init blogic_rdconfig(struct blogic_adapter *adapter)
 		for (i = 0; i < sizeof(fpinfo->model); i++)
 			*tgt++ = fpinfo->model[i];
 		*tgt++ = '\0';
-		strcpy(adapter->fw_ver, FLASHPOINT_FW_VER);
+		strscpy(adapter->fw_ver, FLASHPOINT_FW_VER);
 		adapter->scsi_id = fpinfo->scsi_id;
 		adapter->ext_trans_enable = fpinfo->ext_trans_enable;
 		adapter->parity = fpinfo->parity;
@@ -3451,12 +3451,12 @@ static void blogic_msg(enum blogic_msglevel msglevel, char *fmt,
 	va_end(args);
 	if (msglevel == BLOGIC_ANNOUNCE_LEVEL) {
 		static int msglines = 0;
-		strcpy(&adapter->msgbuf[adapter->msgbuflen], buf);
+		strscpy(&adapter->msgbuf[adapter->msgbuflen], buf);
 		adapter->msgbuflen += len;
 		if (++msglines <= 2)
 			printk("%sscsi: %s", blogic_msglevelmap[msglevel], buf);
 	} else if (msglevel == BLOGIC_INFO_LEVEL) {
-		strcpy(&adapter->msgbuf[adapter->msgbuflen], buf);
+		strscpy(&adapter->msgbuf[adapter->msgbuflen], buf);
 		adapter->msgbuflen += len;
 		if (begin) {
 			if (buf[0] != '\n' || len > 1)

---
base-commit: 173b959a8bb814f55660f7c34ddedd4e75c203d2
change-id: 20260314-strcpy-da7093836551

Best regards,
-- 
Atharv Dubey <atharvd440@gmail.com>


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

end of thread, other threads:[~2026-03-26 14:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-13 20:28 [PATCH] scsi: buslogic: replace strcpy() with strscpy() Atharv Dubey
2026-03-19 14:43 ` Atharv Dubey
2026-03-26 14:01   ` Atharv Dubey

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