summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXu Panda <xu.panda@zte.com.cn>2022-12-03 14:17:16 +0800
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2022-12-08 11:34:51 +0100
commitef92750e11d2289fced9ff2ce211f8f790225c86 (patch)
tree7738429b0623d7bc65a48f93865c16a774696100
parentf5739014669a734e42af9e73deb1ca165f49b5ae (diff)
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>
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-bootmem.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/mips/cavium-octeon/executive/cvmx-bootmem.c b/arch/mips/cavium-octeon/executive/cvmx-bootmem.c
index 306cee07ce3f..334bf8e577e5 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-bootmem.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-bootmem.c
@@ -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))