Skip to content

Commit 14be375

Browse files
Wolfram Sangmpe
authored andcommitted
powerpc: 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. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Link: https://lore.kernel.org/r/[email protected]
1 parent f7d5f00 commit 14be375

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

arch/powerpc/kernel/dt_cpu_ftrs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ static int __init dt_cpu_ftrs_scan_callback(unsigned long node, const char
10991099

11001100
prop = of_get_flat_dt_prop(node, "display-name", NULL);
11011101
if (prop && strlen((char *)prop) != 0) {
1102-
strlcpy(dt_cpu_name, (char *)prop, sizeof(dt_cpu_name));
1102+
strscpy(dt_cpu_name, (char *)prop, sizeof(dt_cpu_name));
11031103
cur_cpu_spec->cpu_name = dt_cpu_name;
11041104
}
11051105

arch/powerpc/platforms/powernv/idle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ static int __init pnv_parse_cpuidle_dt(void)
14111411
goto out;
14121412
}
14131413
for (i = 0; i < nr_idle_states; i++)
1414-
strlcpy(pnv_idle_states[i].name, temp_string[i],
1414+
strscpy(pnv_idle_states[i].name, temp_string[i],
14151415
PNV_IDLE_NAME_LEN);
14161416
nr_pnv_idle_states = nr_idle_states;
14171417
rc = 0;

arch/powerpc/platforms/powernv/pci-ioda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
6767
vaf.va = &args;
6868

6969
if (pe->flags & PNV_IODA_PE_DEV)
70-
strlcpy(pfix, dev_name(&pe->pdev->dev), sizeof(pfix));
70+
strscpy(pfix, dev_name(&pe->pdev->dev), sizeof(pfix));
7171
else if (pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL))
7272
sprintf(pfix, "%04x:%02x ",
7373
pci_domain_nr(pe->pbus), pe->pbus->number);

arch/powerpc/platforms/pseries/hvcserver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ int hvcs_get_partner_info(uint32_t unit_address, struct list_head *head,
176176
= (unsigned int)last_p_partition_ID;
177177

178178
/* copy the Null-term char too */
179-
strlcpy(&next_partner_info->location_code[0],
179+
strscpy(&next_partner_info->location_code[0],
180180
(char *)&pi_buff[2],
181181
sizeof(next_partner_info->location_code));
182182

0 commit comments

Comments
 (0)