From: Kumar Kartikeya Dwivedi Date: Sat, 30 Jan 2021 04:48:28 +0000 (+0530) Subject: staging: qlge/qlge_ethtool.c: Switch from strlcpy to strscpy X-Git-Tag: accepted/tizen/unified/20230118.172025~7876^2~71 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5aadd5c692e6427989656f16ff223cb301cfb8d7;p=platform%2Fkernel%2Flinux-rpi.git staging: qlge/qlge_ethtool.c: Switch from strlcpy to strscpy strlcpy is marked as deprecated in Documentation/process/deprecated.rst, and there is no functional difference when the caller expects truncation (when not checking the return value). strscpy is relatively better as it also avoids scanning the whole source string. This silences the related checkpatch warnings from: 5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy") Signed-off-by: Kumar Kartikeya Dwivedi Link: https://lore.kernel.org/r/20210130044828.121248-1-memxor@gmail.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/qlge/qlge_ethtool.c b/drivers/staging/qlge/qlge_ethtool.c index a296a51..b70570b 100644 --- a/drivers/staging/qlge/qlge_ethtool.c +++ b/drivers/staging/qlge/qlge_ethtool.c @@ -415,15 +415,15 @@ static void qlge_get_drvinfo(struct net_device *ndev, { struct qlge_adapter *qdev = netdev_to_qdev(ndev); - strlcpy(drvinfo->driver, qlge_driver_name, sizeof(drvinfo->driver)); - strlcpy(drvinfo->version, qlge_driver_version, + strscpy(drvinfo->driver, qlge_driver_name, sizeof(drvinfo->driver)); + strscpy(drvinfo->version, qlge_driver_version, sizeof(drvinfo->version)); snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "v%d.%d.%d", (qdev->fw_rev_id & 0x00ff0000) >> 16, (qdev->fw_rev_id & 0x0000ff00) >> 8, (qdev->fw_rev_id & 0x000000ff)); - strlcpy(drvinfo->bus_info, pci_name(qdev->pdev), + strscpy(drvinfo->bus_info, pci_name(qdev->pdev), sizeof(drvinfo->bus_info)); }