crypto/scheduler: fix build with gcc 8.2
diff mbox series

Message ID 20181103145828.24564-1-jerin.jacob@caviumnetworks.com
State Accepted, archived
Delegated to: akhil goyal
Headers show
Series
  • crypto/scheduler: fix build with gcc 8.2
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK

Commit Message

Jerin Jacob Nov. 3, 2018, 2:58 p.m. UTC
build_error:

drivers/crypto/scheduler/scheduler_pmd.c: In function ‘parse_name_arg’:
drivers/crypto/scheduler/scheduler_pmd.c:372:2: error: ‘strncpy’
specified bound 64 equals destination size [-Werror=stringop-truncation]
  strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strncpy may result a not null-terminated string,
replaced it with strlcpy

Fixes: 503e9c5afb38 ("crypto/scheduler: register as vdev driver")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 drivers/crypto/scheduler/scheduler_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Monjalon Nov. 4, 2018, 9:01 p.m. UTC | #1
03/11/2018 15:58, Jerin Jacob:
> build_error:
> 
> drivers/crypto/scheduler/scheduler_pmd.c: In function ‘parse_name_arg’:
> drivers/crypto/scheduler/scheduler_pmd.c:372:2: error: ‘strncpy’
> specified bound 64 equals destination size [-Werror=stringop-truncation]
>   strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> strncpy may result a not null-terminated string,
> replaced it with strlcpy
> 
> Fixes: 503e9c5afb38 ("crypto/scheduler: register as vdev driver")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Applied, thanks

Patch
diff mbox series

diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 20198ccb0..a1632a2b9 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -369,7 +369,7 @@  parse_name_arg(const char *key __rte_unused,
 		return -EINVAL;
 	}
 
-	strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
+	strlcpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
 
 	return 0;
 }