public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Atharv Dubey <atharvd440@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Khalid Aziz <khalid@gonehiking.org>,
	 "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	 "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-scsi@vger.kernel.org, Atharv Dubey <atharvd440@gmail.com>
Subject: [PATCH] scsi: buslogic: replace strcpy() with strscpy()
Date: Sat, 14 Mar 2026 01:58:24 +0530	[thread overview]
Message-ID: <20260314-strcpy-v1-1-0b38691fe11e@gmail.com> (raw)

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>


             reply	other threads:[~2026-03-13 20:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 20:28 Atharv Dubey [this message]
2026-03-19 14:43 ` [PATCH] scsi: buslogic: replace strcpy() with strscpy() Atharv Dubey
2026-03-26 14:01   ` Atharv Dubey

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=20260314-strcpy-v1-1-0b38691fe11e@gmail.com \
    --to=atharvd440@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=khalid@gonehiking.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mchehab@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox