diff mbox

linux-generic: crypto: properly handle errors in packet copy

Message ID 1492610407-22439-1-git-send-email-odpbot@yandex.ru
State New
Headers show

Commit Message

Github ODP bot April 19, 2017, 2 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Add proper handling for errors returned by odp_packet_copy_from_pkt().

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 14 (lumag:crypto-copy)
 ** https://github.com/Linaro/odp/pull/14
 ** Patch: https://github.com/Linaro/odp/pull/14.patch
 ** Base sha: 3e5a07edf190614e739c8dba76cf165330e1b035
 ** Merge commit sha: 0e582f4a02782a2c90ee8f93117e549ca09ab55e
 **/
 platform/linux-generic/odp_crypto.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c
index 54b222f..675b3e2 100644
--- a/platform/linux-generic/odp_crypto.c
+++ b/platform/linux-generic/odp_crypto.c
@@ -886,11 +886,17 @@  odp_crypto_operation(odp_crypto_op_param_t *param,
 	}
 
 	if (param->pkt != param->out_pkt) {
-		(void)odp_packet_copy_from_pkt(param->out_pkt,
+		int ret;
+
+		ret = odp_packet_copy_from_pkt(param->out_pkt,
 					       0,
 					       param->pkt,
 					       0,
 					       odp_packet_len(param->pkt));
+		if (odp_unlikely(ret < 0)) {
+			ODP_DBG("Copy failed.\n");
+			return -1;
+		}
 		_odp_packet_copy_md_to_packet(param->pkt, param->out_pkt);
 		odp_packet_free(param->pkt);
 		param->pkt = ODP_PACKET_INVALID;