Skip to content

Commit 4ea303d

Browse files
tobluxfloatious
authored andcommitted
ata: pata_it821x: Replace deprecated strcpy with strscpy in it821x_display_disk
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: KSPP#88 Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Niklas Cassel <cassel@kernel.org>
1 parent c9d869f commit 4ea303d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/ata/pata_it821x.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
#include <linux/blkdev.h>
7676
#include <linux/delay.h>
7777
#include <linux/slab.h>
78+
#include <linux/string.h>
7879
#include <scsi/scsi_host.h>
7980
#include <linux/libata.h>
8081

@@ -632,9 +633,9 @@ static void it821x_display_disk(struct ata_port *ap, int n, u8 *buf)
632633
cbl = "";
633634

634635
if (mode)
635-
snprintf(mbuf, 8, "%5s%d", mtype, mode - 1);
636+
snprintf(mbuf, sizeof(mbuf), "%5s%d", mtype, mode - 1);
636637
else
637-
strcpy(mbuf, "PIO");
638+
strscpy(mbuf, "PIO");
638639
if (buf[52] == 4)
639640
ata_port_info(ap, "%d: %-6s %-8s %s %s\n",
640641
n, mbuf, types[buf[52]], id, cbl);

0 commit comments

Comments
 (0)