Commit 4ea303d9 authored by Thorsten Blum's avatar Thorsten Blum Committed by Niklas Cassel
Browse files

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: https://github.com/KSPP/linux/issues/88


Signed-off-by: default avatarThorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Signed-off-by: default avatarNiklas Cassel <cassel@kernel.org>
parent c9d869fb
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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);