mirror of https://gitee.com/openkylin/linux.git
atlx: strncpy does not null terminate string
strlcpy() will always null terminate the string. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Cc: Jay Cliburn <jcliburn@gmail.com> Cc: Chris Snook <csnook@redhat.com> Cc: Jie Yang <jie.yang@atheros.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5d5ceb8bdd
commit
082ba88a5e
|
@ -232,11 +232,11 @@ static void atl1c_get_drvinfo(struct net_device *netdev,
|
|||
{
|
||||
struct atl1c_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
strncpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver));
|
||||
strncpy(drvinfo->version, atl1c_driver_version,
|
||||
strlcpy(drvinfo->driver, atl1c_driver_name, sizeof(drvinfo->driver));
|
||||
strlcpy(drvinfo->version, atl1c_driver_version,
|
||||
sizeof(drvinfo->version));
|
||||
strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
|
||||
strncpy(drvinfo->bus_info, pci_name(adapter->pdev),
|
||||
strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
|
||||
strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
|
||||
sizeof(drvinfo->bus_info));
|
||||
drvinfo->n_stats = 0;
|
||||
drvinfo->testinfo_len = 0;
|
||||
|
|
|
@ -3378,11 +3378,11 @@ static void atl1_get_drvinfo(struct net_device *netdev,
|
|||
{
|
||||
struct atl1_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
strncpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver));
|
||||
strncpy(drvinfo->version, ATLX_DRIVER_VERSION,
|
||||
strlcpy(drvinfo->driver, ATLX_DRIVER_NAME, sizeof(drvinfo->driver));
|
||||
strlcpy(drvinfo->version, ATLX_DRIVER_VERSION,
|
||||
sizeof(drvinfo->version));
|
||||
strncpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
|
||||
strncpy(drvinfo->bus_info, pci_name(adapter->pdev),
|
||||
strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version));
|
||||
strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
|
||||
sizeof(drvinfo->bus_info));
|
||||
drvinfo->eedump_len = ATL1_EEDUMP_LEN;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue