Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp272190pxb; Mon, 8 Feb 2021 23:06:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFdo7mIRJFxKR3G8uBTWuLba7AhoV7zH/jy1TsGwQfLJcU84+YM3lU9J177SW5jSnsz8zs X-Received: by 2002:a17:907:2897:: with SMTP id em23mr21113003ejc.550.1612854375940; Mon, 08 Feb 2021 23:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612854375; cv=none; d=google.com; s=arc-20160816; b=iWne2EsCD8hMFaPwDBNBv16OMo9A6ZlU5TZvlHHp8PKZS8/unRTnATSl+1wjkzhbsI 0QMTrBuCLmaZ5ZismLV/8btVIch3pF3hTQ3mcxbLG80QDm6aP9YHwOIWpAZsbJ27FmvL 6HHq3DqhQUL079AjkGlwOvN8pd5EslVQCJKUXtyCK38r+Nu12vtYHJmpzgYPOv4XGU3Q BSrbjbEoY/8MrePr4+/q0QuerYEDWCKapE4cfheRGa/L9OeB3JwJfFTSjA/WONN1nDro ufr2ElkklKN/JO4hcJq0EvpW3kBmzMC7lMYa8oqIRUqdr0Yx/PQQUw81PaBkiVkxoBul P1VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=j8ZgaBm97OINaidIcBJHtM4Mf8X4ZJhwpOd5dUL0cc4=; b=HYC8f2VO7/FcrWjUkHJfpjL3JezeiSRTiRBHACPCjl4YlSgyv4FxePrUFI0WLsW8Zx WHHZEZcVF2S6O6lncJb46yAsn7LeaclH9D+rkeMAq2Gswe8qbxRDuuLTn8SPW9Z8/WvZ dz1B1bkuXEm23pV9JoQRbOQ8wBQ2GGVl8rhZmH5y0EY4mrQEZOQ3r5+FHQayRS/VrRkI lCdAgzeEQ4g01f32uIoeX72Z7jf2gAkCEUCPvz1117wBcqfGzT0tA/f83CoTLI3DREwz v3MvMKhv9z1Vb97m1a+tUDIQxFCBEY3UZsoyt47VXGwaVTkTkh2xbv65jU1qeLOu8G27 4a+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jj13si32136ejc.60.2021.02.08.23.05.49; Mon, 08 Feb 2021 23:06:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229636AbhBIHEo (ORCPT + 99 others); Tue, 9 Feb 2021 02:04:44 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:11715 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbhBIHEe (ORCPT ); Tue, 9 Feb 2021 02:04:34 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DZYjT3MmXzlJ0t; Tue, 9 Feb 2021 15:02:05 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Tue, 9 Feb 2021 15:03:31 +0800 From: chenxiang To: , , , , CC: , , , Xiang Chen Subject: [PATCH 2/4] crypto: cavium - Fix the parameter of dma_unmap_sg() Date: Tue, 9 Feb 2021 14:59:23 +0800 Message-ID: <1612853965-67777-3-git-send-email-chenxiang66@hisilicon.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1612853965-67777-1-git-send-email-chenxiang66@hisilicon.com> References: <1612853965-67777-1-git-send-email-chenxiang66@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Xiang Chen For function dma_unmap_sg(), the parameter should be number of elements in the scatterlist prior to the mapping, not after the mapping. So fix this usage. Signed-off-by: Xiang Chen --- drivers/crypto/cavium/nitrox/nitrox_reqmgr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c index 53ef067..1263194 100644 --- a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c +++ b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c @@ -170,7 +170,7 @@ static int dma_map_inbufs(struct nitrox_softreq *sr, sr->in.total_bytes += sg_dma_len(sg); sr->in.sg = req->src; - sr->in.sgmap_cnt = nents; + sr->in.sgmap_cnt = sg_nents(req->src); ret = create_sg_component(sr, &sr->in, sr->in.sgmap_cnt); if (ret) goto incomp_err; @@ -178,7 +178,7 @@ static int dma_map_inbufs(struct nitrox_softreq *sr, return 0; incomp_err: - dma_unmap_sg(dev, req->src, nents, DMA_BIDIRECTIONAL); + dma_unmap_sg(dev, req->src, sg_nents(req->src), DMA_BIDIRECTIONAL); sr->in.sgmap_cnt = 0; return ret; } @@ -195,7 +195,7 @@ static int dma_map_outbufs(struct nitrox_softreq *sr, return -EINVAL; sr->out.sg = req->dst; - sr->out.sgmap_cnt = nents; + sr->out.sgmap_cnt = sg_nents(req->dst); ret = create_sg_component(sr, &sr->out, sr->out.sgmap_cnt); if (ret) goto outcomp_map_err; @@ -203,7 +203,7 @@ static int dma_map_outbufs(struct nitrox_softreq *sr, return 0; outcomp_map_err: - dma_unmap_sg(dev, req->dst, nents, DMA_BIDIRECTIONAL); + dma_unmap_sg(dev, req->dst, sg_nents(req->dst), DMA_BIDIRECTIONAL); sr->out.sgmap_cnt = 0; sr->out.sg = NULL; return ret; -- 2.8.1