mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
wifi: move from strlcpy with unused retval to strscpy
Follow the advice of the below link and prefer 'strscpy' in this subsystem. Conversion is 1:1 because the return value is not used. Generated by a coccinelle script. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20220830201457.7984-2-wsa+renesas@sang-engineering.com
This commit is contained in:
parent
1dc13236ef
commit
bf99f11df4
@ -1014,7 +1014,7 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
|
||||
|
||||
switch (ie_id) {
|
||||
case ATH6KL_FW_IE_FW_VERSION:
|
||||
strlcpy(ar->wiphy->fw_version, data,
|
||||
strscpy(ar->wiphy->fw_version, data,
|
||||
min(sizeof(ar->wiphy->fw_version), ie_len+1));
|
||||
|
||||
ath6kl_dbg(ATH6KL_DBG_BOOT,
|
||||
|
@ -105,7 +105,7 @@ static void carl9170_fw_info(struct ar9170 *ar)
|
||||
CARL9170FW_GET_MONTH(fw_date),
|
||||
CARL9170FW_GET_DAY(fw_date));
|
||||
|
||||
strlcpy(ar->hw->wiphy->fw_version, motd_desc->release,
|
||||
strscpy(ar->hw->wiphy->fw_version, motd_desc->release,
|
||||
sizeof(ar->hw->wiphy->fw_version));
|
||||
}
|
||||
}
|
||||
|
@ -1305,7 +1305,7 @@ void wil_get_board_file(struct wil6210_priv *wil, char *buf, size_t len)
|
||||
board_file = WIL_BOARD_FILE_NAME;
|
||||
}
|
||||
|
||||
strlcpy(buf, board_file, len);
|
||||
strscpy(buf, board_file, len);
|
||||
}
|
||||
|
||||
static int wil_get_bl_info(struct wil6210_priv *wil)
|
||||
|
@ -445,7 +445,7 @@ int wil_if_add(struct wil6210_priv *wil)
|
||||
|
||||
wil_dbg_misc(wil, "entered");
|
||||
|
||||
strlcpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version));
|
||||
strscpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version));
|
||||
|
||||
rc = wiphy_register(wiphy);
|
||||
if (rc < 0) {
|
||||
|
@ -780,7 +780,7 @@ static void wmi_evt_ready(struct wil6210_vif *vif, int id, void *d, int len)
|
||||
return; /* FW load will fail after timeout */
|
||||
}
|
||||
/* ignore MAC address, we already have it from the boot loader */
|
||||
strlcpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version));
|
||||
strscpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version));
|
||||
|
||||
if (len > offsetof(struct wmi_ready_event, rfc_read_calib_result)) {
|
||||
wil_dbg_wmi(wil, "rfc calibration result %d\n",
|
||||
|
@ -1518,7 +1518,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
|
||||
priv->firmware = NULL;
|
||||
priv->firmware_type = fw_type;
|
||||
if (firmware) /* module parameter */
|
||||
strlcpy(priv->firmware_id, firmware, sizeof(priv->firmware_id));
|
||||
strscpy(priv->firmware_id, firmware, sizeof(priv->firmware_id));
|
||||
priv->bus_type = card_present ? BUS_TYPE_PCCARD : BUS_TYPE_PCI;
|
||||
priv->station_state = STATION_STATE_DOWN;
|
||||
priv->do_rx_crc = 0;
|
||||
|
@ -118,7 +118,7 @@ static int b43_register_led(struct b43_wldev *dev, struct b43_led *led,
|
||||
led->wl = dev->wl;
|
||||
led->index = led_index;
|
||||
led->activelow = activelow;
|
||||
strlcpy(led->name, name, sizeof(led->name));
|
||||
strscpy(led->name, name, sizeof(led->name));
|
||||
atomic_set(&led->state, 0);
|
||||
|
||||
led->led_dev.name = led->name;
|
||||
|
@ -88,7 +88,7 @@ static int b43legacy_register_led(struct b43legacy_wldev *dev,
|
||||
led->dev = dev;
|
||||
led->index = led_index;
|
||||
led->activelow = activelow;
|
||||
strlcpy(led->name, name, sizeof(led->name));
|
||||
strscpy(led->name, name, sizeof(led->name));
|
||||
|
||||
led->led_dev.name = led->name;
|
||||
led->led_dev.default_trigger = default_trigger;
|
||||
|
@ -261,7 +261,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
|
||||
&revinfo, sizeof(revinfo));
|
||||
if (err < 0) {
|
||||
bphy_err(drvr, "retrieving revision info failed, %d\n", err);
|
||||
strlcpy(ri->chipname, "UNKNOWN", sizeof(ri->chipname));
|
||||
strscpy(ri->chipname, "UNKNOWN", sizeof(ri->chipname));
|
||||
} else {
|
||||
ri->vendorid = le32_to_cpu(revinfo.vendorid);
|
||||
ri->deviceid = le32_to_cpu(revinfo.deviceid);
|
||||
@ -314,7 +314,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
|
||||
|
||||
/* locate firmware version number for ethtool */
|
||||
ptr = strrchr(buf, ' ') + 1;
|
||||
strlcpy(ifp->drvr->fwver, ptr, sizeof(ifp->drvr->fwver));
|
||||
strscpy(ifp->drvr->fwver, ptr, sizeof(ifp->drvr->fwver));
|
||||
|
||||
/* Query for 'clmver' to get CLM version info from firmware */
|
||||
memset(buf, 0, sizeof(buf));
|
||||
@ -424,11 +424,11 @@ static void brcmf_mp_attach(void)
|
||||
* if not set then if available use the platform data version. To make
|
||||
* sure it gets initialized at all, always copy the module param version
|
||||
*/
|
||||
strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
|
||||
strscpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
|
||||
BRCMF_FW_ALTPATH_LEN);
|
||||
if ((brcmfmac_pdata) && (brcmfmac_pdata->fw_alternative_path) &&
|
||||
(brcmf_mp_global.firmware_path[0] == '\0')) {
|
||||
strlcpy(brcmf_mp_global.firmware_path,
|
||||
strscpy(brcmf_mp_global.firmware_path,
|
||||
brcmfmac_pdata->fw_alternative_path,
|
||||
BRCMF_FW_ALTPATH_LEN);
|
||||
}
|
||||
|
@ -561,10 +561,10 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *ndev,
|
||||
|
||||
if (drvr->revinfo.result == 0)
|
||||
brcmu_dotrev_str(drvr->revinfo.driverrev, drev);
|
||||
strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
|
||||
strlcpy(info->version, drev, sizeof(info->version));
|
||||
strlcpy(info->fw_version, drvr->fwver, sizeof(info->fw_version));
|
||||
strlcpy(info->bus_info, dev_name(drvr->bus_if->dev),
|
||||
strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
|
||||
strscpy(info->version, drev, sizeof(info->version));
|
||||
strscpy(info->fw_version, drvr->fwver, sizeof(info->fw_version));
|
||||
strscpy(info->bus_info, dev_name(drvr->bus_if->dev),
|
||||
sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
|
@ -769,7 +769,7 @@ brcmf_fw_alloc_request(u32 chip, u32 chiprev,
|
||||
fwnames[j].path[0] = '\0';
|
||||
/* check if firmware path is provided by module parameter */
|
||||
if (brcmf_mp_global.firmware_path[0] != '\0') {
|
||||
strlcpy(fwnames[j].path, mp_path,
|
||||
strscpy(fwnames[j].path, mp_path,
|
||||
BRCMF_FW_NAME_LEN);
|
||||
|
||||
if (end != '/') {
|
||||
|
@ -688,7 +688,7 @@ static void brcmf_fws_macdesc_set_name(struct brcmf_fws_info *fws,
|
||||
struct brcmf_fws_mac_descriptor *desc)
|
||||
{
|
||||
if (desc == &fws->desc.other)
|
||||
strlcpy(desc->name, "MAC-OTHER", sizeof(desc->name));
|
||||
strscpy(desc->name, "MAC-OTHER", sizeof(desc->name));
|
||||
else if (desc->mac_handle)
|
||||
scnprintf(desc->name, sizeof(desc->name), "MAC-%d:%d",
|
||||
desc->mac_handle, desc->interface_id);
|
||||
|
@ -5907,8 +5907,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
|
||||
struct ipw2100_priv *priv = libipw_priv(dev);
|
||||
char fw_ver[64], ucode_ver[64];
|
||||
|
||||
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
strscpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strscpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
|
||||
ipw2100_get_fwversion(priv, fw_ver, sizeof(fw_ver));
|
||||
ipw2100_get_ucodeversion(priv, ucode_ver, sizeof(ucode_ver));
|
||||
@ -5916,7 +5916,7 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
|
||||
snprintf(info->fw_version, sizeof(info->fw_version), "%s:%d:%s",
|
||||
fw_ver, priv->eeprom_version, ucode_ver);
|
||||
|
||||
strlcpy(info->bus_info, pci_name(priv->pci_dev),
|
||||
strscpy(info->bus_info, pci_name(priv->pci_dev),
|
||||
sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
|
@ -10424,8 +10424,8 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
|
||||
char date[32];
|
||||
u32 len;
|
||||
|
||||
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
strscpy(info->driver, DRV_NAME, sizeof(info->driver));
|
||||
strscpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
|
||||
len = sizeof(vers);
|
||||
ipw_get_ordinal(p, IPW_ORD_STAT_FW_VERSION, vers, &len);
|
||||
@ -10434,7 +10434,7 @@ static void ipw_ethtool_get_drvinfo(struct net_device *dev,
|
||||
|
||||
snprintf(info->fw_version, sizeof(info->fw_version), "%s (%s)",
|
||||
vers, date);
|
||||
strlcpy(info->bus_info, pci_name(p->pci_dev),
|
||||
strscpy(info->bus_info, pci_name(p->pci_dev),
|
||||
sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
|
@ -3254,7 +3254,7 @@ il3945_store_measurement(struct device *d, struct device_attribute *attr,
|
||||
|
||||
if (count) {
|
||||
char *p = buffer;
|
||||
strlcpy(buffer, buf, sizeof(buffer));
|
||||
strscpy(buffer, buf, sizeof(buffer));
|
||||
channel = simple_strtoul(p, NULL, 0);
|
||||
if (channel)
|
||||
params.channel = channel;
|
||||
|
@ -3848,7 +3848,7 @@ static void prism2_get_drvinfo(struct net_device *dev,
|
||||
iface = netdev_priv(dev);
|
||||
local = iface->local;
|
||||
|
||||
strlcpy(info->driver, "hostap", sizeof(info->driver));
|
||||
strscpy(info->driver, "hostap", sizeof(info->driver));
|
||||
snprintf(info->fw_version, sizeof(info->fw_version),
|
||||
"%d.%d.%d", (local->sta_fw_ver >> 16) & 0xff,
|
||||
(local->sta_fw_ver >> 8) & 0xff,
|
||||
|
@ -20,8 +20,8 @@ static void lbs_ethtool_get_drvinfo(struct net_device *dev,
|
||||
priv->fwrelease >> 16 & 0xff,
|
||||
priv->fwrelease >> 8 & 0xff,
|
||||
priv->fwrelease & 0xff);
|
||||
strlcpy(info->driver, "libertas", sizeof(info->driver));
|
||||
strlcpy(info->version, lbs_driver_version, sizeof(info->version));
|
||||
strscpy(info->driver, "libertas", sizeof(info->driver));
|
||||
strscpy(info->version, lbs_driver_version, sizeof(info->version));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -229,7 +229,7 @@ struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,
|
||||
return NULL;
|
||||
|
||||
wl->monitor_dev->type = ARPHRD_IEEE80211_RADIOTAP;
|
||||
strlcpy(wl->monitor_dev->name, name, IFNAMSIZ);
|
||||
strscpy(wl->monitor_dev->name, name, IFNAMSIZ);
|
||||
wl->monitor_dev->netdev_ops = &wilc_wfi_netdev_ops;
|
||||
wl->monitor_dev->needs_free_netdev = true;
|
||||
|
||||
|
@ -1223,7 +1223,7 @@ int qtnf_wiphy_register(struct qtnf_hw_info *hw_info, struct qtnf_wmac *mac)
|
||||
mac->macinfo.extended_capabilities_len;
|
||||
}
|
||||
|
||||
strlcpy(wiphy->fw_version, hw_info->fw_version,
|
||||
strscpy(wiphy->fw_version, hw_info->fw_version,
|
||||
sizeof(wiphy->fw_version));
|
||||
wiphy->hw_version = hw_info->hw_version;
|
||||
|
||||
|
@ -967,7 +967,7 @@ qtnf_cmd_resp_proc_hw_info(struct qtnf_bus *bus,
|
||||
hwinfo->total_rx_chain, hwinfo->total_tx_chain,
|
||||
hwinfo->fw_ver);
|
||||
|
||||
strlcpy(hwinfo->fw_version, bld_label, sizeof(hwinfo->fw_version));
|
||||
strscpy(hwinfo->fw_version, bld_label, sizeof(hwinfo->fw_version));
|
||||
hwinfo->hw_version = hw_ver;
|
||||
|
||||
return 0;
|
||||
|
@ -143,7 +143,7 @@ static int rtl8187_register_led(struct ieee80211_hw *dev,
|
||||
led->dev = dev;
|
||||
led->ledpin = ledpin;
|
||||
led->is_radio = is_radio;
|
||||
strlcpy(led->name, name, sizeof(led->name));
|
||||
strscpy(led->name, name, sizeof(led->name));
|
||||
|
||||
led->led_dev.name = led->name;
|
||||
led->led_dev.default_trigger = default_trigger;
|
||||
|
@ -1441,7 +1441,7 @@ static void wl3501_detach(struct pcmcia_device *link)
|
||||
static int wl3501_get_name(struct net_device *dev, struct iw_request_info *info,
|
||||
union iwreq_data *wrqu, char *extra)
|
||||
{
|
||||
strlcpy(wrqu->name, "IEEE 802.11-DS", sizeof(wrqu->name));
|
||||
strscpy(wrqu->name, "IEEE 802.11-DS", sizeof(wrqu->name));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1652,7 +1652,7 @@ static int wl3501_set_nick(struct net_device *dev, struct iw_request_info *info,
|
||||
|
||||
if (wrqu->data.length > sizeof(this->nick))
|
||||
return -E2BIG;
|
||||
strlcpy(this->nick, extra, wrqu->data.length);
|
||||
strscpy(this->nick, extra, wrqu->data.length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1661,7 +1661,7 @@ static int wl3501_get_nick(struct net_device *dev, struct iw_request_info *info,
|
||||
{
|
||||
struct wl3501_card *this = netdev_priv(dev);
|
||||
|
||||
strlcpy(extra, this->nick, 32);
|
||||
strscpy(extra, this->nick, 32);
|
||||
wrqu->data.length = strlen(extra);
|
||||
return 0;
|
||||
}
|
||||
@ -1965,7 +1965,7 @@ static int wl3501_config(struct pcmcia_device *link)
|
||||
this->firmware_date[0] = '\0';
|
||||
this->rssi = 255;
|
||||
this->chan = iw_default_channel(this->reg_domain);
|
||||
strlcpy(this->nick, "Planet WL3501", sizeof(this->nick));
|
||||
strscpy(this->nick, "Planet WL3501", sizeof(this->nick));
|
||||
spin_lock_init(&this->lock);
|
||||
init_waitqueue_head(&this->wait);
|
||||
netif_start_queue(dev);
|
||||
|
Loading…
Reference in New Issue
Block a user