From patchwork Mon Mar 13 11:44:08 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: 95203 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp1131843qgd; Mon, 13 Mar 2017 04:44:19 -0700 (PDT) X-Received: by 10.200.45.59 with SMTP id n56mr32182302qta.137.1489405459507; Mon, 13 Mar 2017 04:44:19 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g11si205926qtb.242.2017.03.13.04.44.19; Mon, 13 Mar 2017 04:44:19 -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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0F9C463CAB; Mon, 13 Mar 2017 11:44:19 +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 8BDEC63CA5; Mon, 13 Mar 2017 11:44:15 +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 668FF63CA6; Mon, 13 Mar 2017 11:44:13 +0000 (UTC) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) by lists.linaro.org (Postfix) with ESMTPS id D38C163CA3 for ; Mon, 13 Mar 2017 11:44:11 +0000 (UTC) Received: by mail-lf0-f42.google.com with SMTP id j90so62409973lfk.2 for ; Mon, 13 Mar 2017 04:44:11 -0700 (PDT) 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=fKPwY2pLchMFSB+kQ65iLZFwciyH7KhWDCwIriedDCc=; b=jf0NSbq1Bfxcw82ov/7zF0VDpWhckeYWgrIvLRq1x8nP5W6PhfRwrGNaRayR21Y5ic 325icdDI3S4SJ1pQo4vfvaQRqQpycnC5zXJweOkiH2Tdlo5A1WcQQ83Q4tszaXwcQkDe jdsRVvuOKIG0oGwgoJZZoftvwonz5m/r+ctfM9fpFEh2FZ7oHkYNo6ASKm/G26wRBCBr ZLPYNATvZZRFK1Atcl0cnuR/B2tvtXXJ+VRemojmyYTdLBbfXiC9+jHZSLFfkPkkR+lo 3pWPDzwK0bOa8tTnA6NREtAYIk7p278/IDj5Iq8R6CU9j49h3ZvwRv3OVAqvE/YjzD9C z0bQ== X-Gm-Message-State: AMke39kRueZRTHRv6/2AAdFGOLidDyjTp5zfbu3VHjMfWLsqER6TbDhAzKBvXFrNMzxbEuRw++NW9g== X-Received: by 10.46.75.1 with SMTP id y1mr10065297lja.75.1489405450340; Mon, 13 Mar 2017 04:44:10 -0700 (PDT) Received: from forlindon.lumag.auriga.ru ([188.162.64.11]) by smtp.gmail.com with ESMTPSA id l14sm3454096ljb.66.2017.03.13.04.44.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Mar 2017 04:44:09 -0700 (PDT) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Mon, 13 Mar 2017 14:44:08 +0300 Message-Id: <20170313114408.26283-1-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [lng-odp] [PATCH v2] 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.11.0 Reviewed-by: Bill Fischofer diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 54b222fd..675b3e25 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;