mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 22:54:05 +08:00
crypto: drivers - 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> Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
dd4f8ee7ed
commit
2885586005
@ -97,7 +97,7 @@ static int dev_supports_eng_type(struct otx_cpt_eng_grps *eng_grps,
|
||||
static void set_ucode_filename(struct otx_cpt_ucode *ucode,
|
||||
const char *filename)
|
||||
{
|
||||
strlcpy(ucode->filename, filename, OTX_CPT_UCODE_NAME_LENGTH);
|
||||
strscpy(ucode->filename, filename, OTX_CPT_UCODE_NAME_LENGTH);
|
||||
}
|
||||
|
||||
static char *get_eng_type_str(int eng_type)
|
||||
@ -138,7 +138,7 @@ static int get_ucode_type(struct otx_cpt_ucode_hdr *ucode_hdr, int *ucode_type)
|
||||
u32 i, val = 0;
|
||||
u8 nn;
|
||||
|
||||
strlcpy(tmp_ver_str, ucode_hdr->ver_str, OTX_CPT_UCODE_VER_STR_SZ);
|
||||
strscpy(tmp_ver_str, ucode_hdr->ver_str, OTX_CPT_UCODE_VER_STR_SZ);
|
||||
for (i = 0; i < strlen(tmp_ver_str); i++)
|
||||
tmp_ver_str[i] = tolower(tmp_ver_str[i]);
|
||||
|
||||
@ -1328,7 +1328,7 @@ static ssize_t ucode_load_store(struct device *dev,
|
||||
|
||||
eng_grps = container_of(attr, struct otx_cpt_eng_grps, ucode_load_attr);
|
||||
err_msg = "Invalid engine group format";
|
||||
strlcpy(tmp_buf, buf, OTX_CPT_UCODE_NAME_LENGTH);
|
||||
strscpy(tmp_buf, buf, OTX_CPT_UCODE_NAME_LENGTH);
|
||||
start = tmp_buf;
|
||||
|
||||
has_se = has_ie = has_ae = false;
|
||||
|
@ -68,7 +68,7 @@ static int is_2nd_ucode_used(struct otx2_cpt_eng_grp_info *eng_grp)
|
||||
static void set_ucode_filename(struct otx2_cpt_ucode *ucode,
|
||||
const char *filename)
|
||||
{
|
||||
strlcpy(ucode->filename, filename, OTX2_CPT_NAME_LENGTH);
|
||||
strscpy(ucode->filename, filename, OTX2_CPT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
static char *get_eng_type_str(int eng_type)
|
||||
@ -126,7 +126,7 @@ static int get_ucode_type(struct device *dev,
|
||||
int i, val = 0;
|
||||
u8 nn;
|
||||
|
||||
strlcpy(tmp_ver_str, ucode_hdr->ver_str, OTX2_CPT_UCODE_VER_STR_SZ);
|
||||
strscpy(tmp_ver_str, ucode_hdr->ver_str, OTX2_CPT_UCODE_VER_STR_SZ);
|
||||
for (i = 0; i < strlen(tmp_ver_str); i++)
|
||||
tmp_ver_str[i] = tolower(tmp_ver_str[i]);
|
||||
|
||||
|
@ -251,13 +251,13 @@ int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev,
|
||||
return -ENOMEM;
|
||||
|
||||
INIT_LIST_HEAD(&key_val->list);
|
||||
strlcpy(key_val->key, key, sizeof(key_val->key));
|
||||
strscpy(key_val->key, key, sizeof(key_val->key));
|
||||
|
||||
if (type == ADF_DEC) {
|
||||
snprintf(key_val->val, ADF_CFG_MAX_VAL_LEN_IN_BYTES,
|
||||
"%ld", (*((long *)val)));
|
||||
} else if (type == ADF_STR) {
|
||||
strlcpy(key_val->val, (char *)val, sizeof(key_val->val));
|
||||
strscpy(key_val->val, (char *)val, sizeof(key_val->val));
|
||||
} else if (type == ADF_HEX) {
|
||||
snprintf(key_val->val, ADF_CFG_MAX_VAL_LEN_IN_BYTES,
|
||||
"0x%lx", (unsigned long)val);
|
||||
@ -315,7 +315,7 @@ int adf_cfg_section_add(struct adf_accel_dev *accel_dev, const char *name)
|
||||
if (!sec)
|
||||
return -ENOMEM;
|
||||
|
||||
strlcpy(sec->name, name, sizeof(sec->name));
|
||||
strscpy(sec->name, name, sizeof(sec->name));
|
||||
INIT_LIST_HEAD(&sec->param_head);
|
||||
down_write(&cfg->lock);
|
||||
list_add_tail(&sec->list, &cfg->sec_list);
|
||||
|
@ -363,7 +363,7 @@ static int adf_ctl_ioctl_get_status(struct file *fp, unsigned int cmd,
|
||||
dev_info.num_logical_accel = hw_data->num_logical_accel;
|
||||
dev_info.banks_per_accel = hw_data->num_banks
|
||||
/ hw_data->num_logical_accel;
|
||||
strlcpy(dev_info.name, hw_data->dev_class->name, sizeof(dev_info.name));
|
||||
strscpy(dev_info.name, hw_data->dev_class->name, sizeof(dev_info.name));
|
||||
dev_info.instance_id = hw_data->instance_id;
|
||||
dev_info.type = hw_data->dev_class->type;
|
||||
dev_info.bus = accel_to_pci_dev(accel_dev)->bus->number;
|
||||
|
@ -96,7 +96,7 @@ int adf_ring_debugfs_add(struct adf_etr_ring_data *ring, const char *name)
|
||||
if (!ring_debug)
|
||||
return -ENOMEM;
|
||||
|
||||
strlcpy(ring_debug->ring_name, name, sizeof(ring_debug->ring_name));
|
||||
strscpy(ring_debug->ring_name, name, sizeof(ring_debug->ring_name));
|
||||
snprintf(entry_name, sizeof(entry_name), "ring_%02d",
|
||||
ring->ring_number);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user