MIPS: OCTEON: cvmx-bootmem: use strscpy() to instead of strncpy()
The implementation of strscpy() is more robust and safer. Signed-off-by: Xu Panda <xu.panda@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
This commit is contained in:
parent
f573901466
commit
ef92750e11
|
@ -780,9 +780,8 @@ int64_t cvmx_bootmem_phy_named_block_alloc(uint64_t size, uint64_t min_addr,
|
|||
if (addr_allocated >= 0) {
|
||||
named_block_desc_ptr->base_addr = addr_allocated;
|
||||
named_block_desc_ptr->size = size;
|
||||
strncpy(named_block_desc_ptr->name, name,
|
||||
strscpy(named_block_desc_ptr->name, name,
|
||||
cvmx_bootmem_desc->named_block_name_len);
|
||||
named_block_desc_ptr->name[cvmx_bootmem_desc->named_block_name_len - 1] = 0;
|
||||
}
|
||||
|
||||
if (!(flags & CVMX_BOOTMEM_FLAG_NO_LOCKING))
|
||||
|
|
Loading…
Reference in New Issue