Message ID | 20230109034021.2759215-1-ruifeng.wang@arm.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | akhil goyal |
Headers | show |
Series | [v2] crypto/openssl: fix warning on copy length | expand |
Context | Check | Description |
---|---|---|
ci/checkpatch | warning | coding style issues |
ci/loongarch-compilation | success | Compilation OK |
ci/loongarch-unit-testing | success | Unit Testing PASS |
ci/iol-broadcom-Performance | success | Performance Testing PASS |
ci/iol-mellanox-Performance | success | Performance Testing PASS |
ci/iol-intel-Functional | success | Functional Testing PASS |
ci/iol-aarch64-unit-testing | success | Testing PASS |
ci/iol-intel-Performance | success | Performance Testing PASS |
ci/iol-abi-testing | success | Testing PASS |
ci/github-robot: build | fail | github build: failed |
ci/iol-aarch64-compile-testing | success | Testing PASS |
ci/iol-x86_64-compile-testing | success | Testing PASS |
ci/iol-testing | success | Testing PASS |
ci/iol-x86_64-unit-testing | success | Testing PASS |
ci/Intel-compilation | success | Compilation OK |
ci/intel-Testing | success | Testing PASS |
> When building with gcc 11.2.0, the compiler warns as follows: > In function 'memcpy', > inlined from 'openssl_set_session_auth_parameters' at > ../drivers/crypto/openssl/rte_openssl_pmd.c:699:3, > inlined from 'openssl_set_session_parameters' at > ../drivers/crypto/openssl/rte_openssl_pmd.c:826:9: > /usr/include/aarch64-linux-gnu/bits/string_fortified.h:29:10: warning: > '__builtin_memcpy' forming offset [4, 8] is out of the bounds [0, 4] [-Warray- > bounds] > > Fixed the warning by copying up to string / buffer size. > > Fixes: 75adf1eae44f ("crypto/openssl: update HMAC routine with 3.0 EVP API") > Cc: stable@dpdk.org > Cc: kai.ji@intel.com > > Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com> > Reviewed-by: Feifei Wang <feifei.wang2@arm.com> Applied to dpdk-next-crypto Thanks.
diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 05449b6e98..abcb641a44 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -696,7 +696,7 @@ openssl_set_session_auth_parameters(struct openssl_session *sess, algo = digest_name_get(xform->auth.algo); if (!algo) return -EINVAL; - rte_memcpy(algo_name, algo, (sizeof(algo)+1)); + strlcpy(algo_name, algo, sizeof(algo_name)); mac = EVP_MAC_fetch(NULL, "HMAC", NULL); sess->auth.hmac.ctx = EVP_MAC_CTX_new(mac);