From patchwork Wed Apr 19 14:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 97642 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp336814qgf; Wed, 19 Apr 2017 07:00:24 -0700 (PDT) X-Received: by 10.107.16.135 with SMTP id 7mr3313527ioq.228.1492610424480; Wed, 19 Apr 2017 07:00:24 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 139si3114318iou.204.2017.04.19.07.00.24; Wed, 19 Apr 2017 07:00:24 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id EEBD962DCD; Wed, 19 Apr 2017 14:00:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id DD176608BA; Wed, 19 Apr 2017 14:00:21 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B2552608BA; Wed, 19 Apr 2017 14:00:20 +0000 (UTC) Received: from forward14p.cmail.yandex.net (forward14p.cmail.yandex.net [87.250.241.142]) by lists.linaro.org (Postfix) with ESMTPS id 8D4266063B for ; Wed, 19 Apr 2017 14:00:18 +0000 (UTC) Received: from smtp1m.mail.yandex.net (smtp1m.mail.yandex.net [77.88.61.132]) by forward14p.cmail.yandex.net (Yandex) with ESMTP id B15C922CD0 for ; Wed, 19 Apr 2017 17:00:15 +0300 (MSK) Received: from smtp1m.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1m.mail.yandex.net (Yandex) with ESMTP id BD7BB63C0DF5 for ; Wed, 19 Apr 2017 17:00:13 +0300 (MSK) Received: by smtp1m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2sHQu3DAzR-0Cxe6CLM; Wed, 19 Apr 2017 17:00:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Suid-Status: 1 0 From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 19 Apr 2017 17:00:07 +0300 Message-Id: <1492610407-22439-1-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 Github-pr-num: 14 Subject: [lng-odp] [PATCH] linux-generic: crypto: properly handle errors in packet copy X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Add proper handling for errors returned by odp_packet_copy_from_pkt(). Signed-off-by: Dmitry Eremin-Solenikov --- /** 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 --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;