From patchwork Mon Mar 6 15:37:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 94919 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp1444385qgd; Mon, 6 Mar 2017 07:37:39 -0800 (PST) X-Received: by 10.200.49.162 with SMTP id h31mr18057232qte.50.1488814659765; Mon, 06 Mar 2017 07:37:39 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q18si15713432qtg.203.2017.03.06.07.37.18; Mon, 06 Mar 2017 07:37:39 -0800 (PST) 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 4F87863CA4; Mon, 6 Mar 2017 15:37:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B37BC63703; Mon, 6 Mar 2017 15:37:13 +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 3C35663CA4; Mon, 6 Mar 2017 15:37:10 +0000 (UTC) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by lists.linaro.org (Postfix) with ESMTPS id 15EDA60F2C for ; Mon, 6 Mar 2017 15:37:09 +0000 (UTC) Received: by mail-wm0-f42.google.com with SMTP id v186so67149330wmd.0 for ; Mon, 06 Mar 2017 07:37:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=AKN7ccEYOdElw+Pt7UMi687DI6cvn8DsZP1uPIr9Zc8=; b=Za84yHxE472TI8Iw9/XJBUV3zC+uRY25e0VR+maMxD1+4yIfaM+vRN+P3Tf0kzwS6a u5AGJ7d4QRUCZTjISATSpPonOyZqdtzPmWaMLwiyxJphq5vrAEVN3cpbT/vRMa5woYvT AoO90hn+/P/Rdw5kG54/gPDp9/An2s8nXzyTlm57TCJWYwAjOOx2dEs8xUfp0cRKXGdY bZXnj5K0bpuybXWLW2x6XILYNY92pw7bEftl6zMWbK0U/o0r2JK0z8zathllqpeJMvVS zqS/JLguDppYk6/sdGbHWoGfWqW9q08BMA/I9ZErnacTh64iaE/vIo66uwZnI6bW+pdn 1TwQ== X-Gm-Message-State: AMke39lIQAbKzh2aw7ZXMx/3M3HYq0nAFzCoEO4s3hN9gkHOJ9TXTxferQfqjaLmixwqx3hcNBNOAA== X-Received: by 10.28.95.85 with SMTP id t82mr14525983wmb.107.1488814627986; Mon, 06 Mar 2017 07:37:07 -0800 (PST) Received: from forlindon.c.hoisthospitality.com ([109.74.56.122]) by smtp.gmail.com with ESMTPSA id o2sm15251366wmb.28.2017.03.06.07.37.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 07:37:07 -0800 (PST) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Mon, 6 Mar 2017 18:37:05 +0300 Message-Id: <20170306153705.32381-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 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" Add proper handling for errors returned by odp_packet_copy_from_pkt(). Signed-off-by: Dmitry Eremin-Solenikov --- platform/linux-generic/odp_crypto.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.11.0 diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 54b222fd..d7440c81 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -886,11 +886,14 @@ odp_crypto_operation(odp_crypto_op_param_t *param, } if (param->pkt != param->out_pkt) { - (void)odp_packet_copy_from_pkt(param->out_pkt, - 0, - param->pkt, - 0, - odp_packet_len(param->pkt)); + if (odp_unlikely(odp_packet_copy_from_pkt(param->out_pkt, + 0, + param->pkt, + 0, + odp_packet_len(param->pkt)) < 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;