mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
IB: 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/ Link: https://lore.kernel.org/r/20220818210018.6841-1-wsa+renesas@sang-engineering.com Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
dc13fbf79e
commit
2c34bb6dea
|
@ -292,7 +292,7 @@ static struct config_group *make_cma_dev(struct config_group *group,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
strlcpy(cma_dev_group->name, name, sizeof(cma_dev_group->name));
|
||||
strscpy(cma_dev_group->name, name, sizeof(cma_dev_group->name));
|
||||
|
||||
config_group_init_type_name(&cma_dev_group->ports_group, "ports",
|
||||
&cma_ports_group_type);
|
||||
|
|
|
@ -422,7 +422,7 @@ int ib_device_rename(struct ib_device *ibdev, const char *name)
|
|||
return ret;
|
||||
}
|
||||
|
||||
strlcpy(ibdev->name, name, IB_DEVICE_NAME_MAX);
|
||||
strscpy(ibdev->name, name, IB_DEVICE_NAME_MAX);
|
||||
ret = rename_compat_devs(ibdev);
|
||||
|
||||
downgrade_write(&devices_rwsem);
|
||||
|
@ -1217,7 +1217,7 @@ static int assign_name(struct ib_device *device, const char *name)
|
|||
ret = -ENFILE;
|
||||
goto out;
|
||||
}
|
||||
strlcpy(device->name, dev_name(&device->dev), IB_DEVICE_NAME_MAX);
|
||||
strscpy(device->name, dev_name(&device->dev), IB_DEVICE_NAME_MAX);
|
||||
|
||||
ret = xa_alloc_cyclic(&devices, &device->index, device, xa_limit_31b,
|
||||
&last_id, GFP_KERNEL);
|
||||
|
|
|
@ -725,7 +725,7 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
|
|||
|
||||
/* ib device init */
|
||||
ibdev->node_type = RDMA_NODE_IB_CA;
|
||||
strlcpy(ibdev->node_desc, BNXT_RE_DESC " HCA",
|
||||
strscpy(ibdev->node_desc, BNXT_RE_DESC " HCA",
|
||||
strlen(BNXT_RE_DESC) + 5);
|
||||
ibdev->phys_port_cnt = 1;
|
||||
|
||||
|
|
|
@ -965,7 +965,7 @@ static int allocate_ctxt(struct hfi1_filedata *fd, struct hfi1_devdata *dd,
|
|||
uctxt->userversion = uinfo->userversion;
|
||||
uctxt->flags = hfi1_cap_mask; /* save current flag state */
|
||||
init_waitqueue_head(&uctxt->wait);
|
||||
strlcpy(uctxt->comm, current->comm, sizeof(uctxt->comm));
|
||||
strscpy(uctxt->comm, current->comm, sizeof(uctxt->comm));
|
||||
memcpy(uctxt->uuid, uinfo->uuid, sizeof(uctxt->uuid));
|
||||
uctxt->jkey = generate_jkey(current_uid());
|
||||
hfi1_stats.sps_ctxts++;
|
||||
|
|
|
@ -1801,7 +1801,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
|
|||
|
||||
ib_set_device_ops(ibdev, &hfi1_dev_ops);
|
||||
|
||||
strlcpy(ibdev->node_desc, init_utsname()->nodename,
|
||||
strscpy(ibdev->node_desc, init_utsname()->nodename,
|
||||
sizeof(ibdev->node_desc));
|
||||
|
||||
/*
|
||||
|
|
|
@ -1252,7 +1252,7 @@ static void get_board_id(void *vsd, char *board_id)
|
|||
|
||||
if (be16_to_cpup(vsd + VSD_OFFSET_SIG1) == VSD_SIGNATURE_TOPSPIN &&
|
||||
be16_to_cpup(vsd + VSD_OFFSET_SIG2) == VSD_SIGNATURE_TOPSPIN) {
|
||||
strlcpy(board_id, vsd + VSD_OFFSET_TS_BOARD_ID, MTHCA_BOARD_ID_LEN);
|
||||
strscpy(board_id, vsd + VSD_OFFSET_TS_BOARD_ID, MTHCA_BOARD_ID_LEN);
|
||||
} else {
|
||||
/*
|
||||
* The board ID is a string but the firmware byte
|
||||
|
|
|
@ -1363,7 +1363,7 @@ static int ocrdma_mbx_get_ctrl_attribs(struct ocrdma_dev *dev)
|
|||
dev->hba_port_num = (hba_attribs->ptpnum_maxdoms_hbast_cv &
|
||||
OCRDMA_HBA_ATTRB_PTNUM_MASK)
|
||||
>> OCRDMA_HBA_ATTRB_PTNUM_SHIFT;
|
||||
strlcpy(dev->model_number,
|
||||
strscpy(dev->model_number,
|
||||
hba_attribs->controller_model_number,
|
||||
sizeof(dev->model_number));
|
||||
}
|
||||
|
|
|
@ -2124,7 +2124,7 @@ static void qib_7322_handle_hwerrors(struct qib_devdata *dd, char *msg,
|
|||
|
||||
if (hwerrs & HWE_MASK(PowerOnBISTFailed)) {
|
||||
isfatal = 1;
|
||||
strlcpy(msg,
|
||||
strscpy(msg,
|
||||
"[Memory BIST test failed, InfiniPath hardware unusable]",
|
||||
msgl);
|
||||
/* ignore from now on, so disable until driver reloaded */
|
||||
|
|
|
@ -65,10 +65,10 @@ static void ipoib_get_drvinfo(struct net_device *netdev,
|
|||
|
||||
ib_get_device_fw_str(priv->ca, drvinfo->fw_version);
|
||||
|
||||
strlcpy(drvinfo->bus_info, dev_name(priv->ca->dev.parent),
|
||||
strscpy(drvinfo->bus_info, dev_name(priv->ca->dev.parent),
|
||||
sizeof(drvinfo->bus_info));
|
||||
|
||||
strlcpy(drvinfo->driver, "ib_ipoib", sizeof(drvinfo->driver));
|
||||
strscpy(drvinfo->driver, "ib_ipoib", sizeof(drvinfo->driver));
|
||||
}
|
||||
|
||||
static int ipoib_get_coalesce(struct net_device *dev,
|
||||
|
|
|
@ -124,8 +124,8 @@ static struct vnic_stats vnic_gstrings_stats[] = {
|
|||
static void vnic_get_drvinfo(struct net_device *netdev,
|
||||
struct ethtool_drvinfo *drvinfo)
|
||||
{
|
||||
strlcpy(drvinfo->driver, opa_vnic_driver_name, sizeof(drvinfo->driver));
|
||||
strlcpy(drvinfo->bus_info, dev_name(netdev->dev.parent),
|
||||
strscpy(drvinfo->driver, opa_vnic_driver_name, sizeof(drvinfo->driver));
|
||||
strscpy(drvinfo->bus_info, dev_name(netdev->dev.parent),
|
||||
sizeof(drvinfo->bus_info));
|
||||
}
|
||||
|
||||
|
|
|
@ -2300,7 +2300,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev,
|
|||
goto free_recv_ring;
|
||||
}
|
||||
|
||||
strlcpy(ch->sess_name, src_addr, sizeof(ch->sess_name));
|
||||
strscpy(ch->sess_name, src_addr, sizeof(ch->sess_name));
|
||||
snprintf(i_port_id, sizeof(i_port_id), "0x%016llx%016llx",
|
||||
be64_to_cpu(*(__be64 *)nexus->i_port_id),
|
||||
be64_to_cpu(*(__be64 *)(nexus->i_port_id + 8)));
|
||||
|
|
|
@ -445,7 +445,7 @@ static inline void rvt_set_ibdev_name(struct rvt_dev_info *rdi,
|
|||
* to work by setting the name manually here.
|
||||
*/
|
||||
dev_set_name(&rdi->ibdev.dev, fmt, name, unit);
|
||||
strlcpy(rdi->ibdev.name, dev_name(&rdi->ibdev.dev), IB_DEVICE_NAME_MAX);
|
||||
strscpy(rdi->ibdev.name, dev_name(&rdi->ibdev.dev), IB_DEVICE_NAME_MAX);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue