Skip to content

Commit ef92750

Browse files
Xu Pandatsbogend
authored andcommitted
MIPS: OCTEON: cvmx-bootmem: use strscpy() to instead of strncpy()
The implementation of strscpy() is more robust and safer. Signed-off-by: Xu Panda <[email protected]> Signed-off-by: Yang Yang <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent f573901 commit ef92750

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/mips/cavium-octeon/executive/cvmx-bootmem.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,8 @@ int64_t cvmx_bootmem_phy_named_block_alloc(uint64_t size, uint64_t min_addr,
780780
if (addr_allocated >= 0) {
781781
named_block_desc_ptr->base_addr = addr_allocated;
782782
named_block_desc_ptr->size = size;
783-
strncpy(named_block_desc_ptr->name, name,
783+
strscpy(named_block_desc_ptr->name, name,
784784
cvmx_bootmem_desc->named_block_name_len);
785-
named_block_desc_ptr->name[cvmx_bootmem_desc->named_block_name_len - 1] = 0;
786785
}
787786

788787
if (!(flags & CVMX_BOOTMEM_FLAG_NO_LOCKING))

0 commit comments

Comments
 (0)