* [PATCH] ata: Replace deprecated strcpy with strscpy in it821x_display_disk
@ 2025-10-18 10:51 Thorsten Blum
2025-10-19 3:44 ` Damien Le Moal
2025-10-23 12:28 ` Niklas Cassel
0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2025-10-18 10:51 UTC (permalink / raw)
To: Damien Le Moal, Niklas Cassel
Cc: linux-hardening, Thorsten Blum, linux-ide, linux-kernel
strcpy() is deprecated; use strscpy() instead.
Replace the hard-coded buffer size 8 with sizeof(mbuf) when using
snprintf() while we're at it.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/ata/pata_it821x.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 042f6ad1f7c6..fc762dcc61bf 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -75,6 +75,7 @@
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/slab.h>
+#include <linux/string.h>
#include <scsi/scsi_host.h>
#include <linux/libata.h>
@@ -632,9 +633,9 @@ static void it821x_display_disk(struct ata_port *ap, int n, u8 *buf)
cbl = "";
if (mode)
- snprintf(mbuf, 8, "%5s%d", mtype, mode - 1);
+ snprintf(mbuf, sizeof(mbuf), "%5s%d", mtype, mode - 1);
else
- strcpy(mbuf, "PIO");
+ strscpy(mbuf, "PIO");
if (buf[52] == 4)
ata_port_info(ap, "%d: %-6s %-8s %s %s\n",
n, mbuf, types[buf[52]], id, cbl);
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ata: Replace deprecated strcpy with strscpy in it821x_display_disk
2025-10-18 10:51 [PATCH] ata: Replace deprecated strcpy with strscpy in it821x_display_disk Thorsten Blum
@ 2025-10-19 3:44 ` Damien Le Moal
2025-10-23 12:28 ` Niklas Cassel
1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2025-10-19 3:44 UTC (permalink / raw)
To: Thorsten Blum, Niklas Cassel; +Cc: linux-hardening, linux-ide, linux-kernel
On 10/18/25 19:51, Thorsten Blum wrote:
> strcpy() is deprecated; use strscpy() instead.
>
> Replace the hard-coded buffer size 8 with sizeof(mbuf) when using
> snprintf() while we're at it.
>
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Note: the patch title should be:
ata: pata_it821x: Replace deprecated strcpy with strscpy in it821x_display_disk
Niklas can fix that when applying I think.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ata: Replace deprecated strcpy with strscpy in it821x_display_disk
2025-10-18 10:51 [PATCH] ata: Replace deprecated strcpy with strscpy in it821x_display_disk Thorsten Blum
2025-10-19 3:44 ` Damien Le Moal
@ 2025-10-23 12:28 ` Niklas Cassel
1 sibling, 0 replies; 3+ messages in thread
From: Niklas Cassel @ 2025-10-23 12:28 UTC (permalink / raw)
To: Thorsten Blum; +Cc: Damien Le Moal, linux-hardening, linux-ide, linux-kernel
On Sat, Oct 18, 2025 at 12:51:45PM +0200, Thorsten Blum wrote:
> strcpy() is deprecated; use strscpy() instead.
>
> Replace the hard-coded buffer size 8 with sizeof(mbuf) when using
> snprintf() while we're at it.
>
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Applied, thank you!
https://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git/commit/?h=for-6.19&id=4ea303d9e9862ff8bd3707f67b267646b8ffd3ec
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-23 12:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-18 10:51 [PATCH] ata: Replace deprecated strcpy with strscpy in it821x_display_disk Thorsten Blum
2025-10-19 3:44 ` Damien Le Moal
2025-10-23 12:28 ` Niklas Cassel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).