Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3906612pxf; Tue, 16 Mar 2021 00:15:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsKbyhAHxkzLoZW4SjNToNZHPuYHJ/jWF+q7+G0HGKaLT505AJ+hhue7GmVVUreowg5by8 X-Received: by 2002:a05:6402:2744:: with SMTP id z4mr11306903edd.347.1615878919333; Tue, 16 Mar 2021 00:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615878919; cv=none; d=google.com; s=arc-20160816; b=V/5jotnWDBXk6BlWUVwne0zkOOIWXaUN4Lo+Av6zXxJqCsqaAf0Hb33ndyDNPgPBAj lXSPujJ7bf24o38zEbLDe9OftxtlvHm682nAvb6a4rPVEBs/hY/GgWAgjq2VkoSFuxRz 4fVEY7jKt/OKNkDkIWNizJJ945CvvtIT2VUe5gkN5aR435uRzemJBjnxCpgl9jCsNIv9 2d/E5EHTJpq/HzsILghccxCDGgqvcX2GWGv0uURD1nH/8Q6mBxOsPzSTmsey3oHOQmGZ XoDg40KONIv5ZPGB/wp8fagvcW4IerEWEvK606nMMV/xaIr6rUVUvhpmysnFY3+gqUr3 9zYA== 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=rOYQB7b0KAIHYYqot1jK67c/3DXQsF8giUlh+mdP91o=; b=M1SfarGeAQoE3WptvlrlqIhZ4NVw3Ve1iORinYno4IEKcPVdSPj/iEWv3lk3mbKpE2 yNhwmw2mkdUUYwp8TW4dywZ2m6839m59ss1QLQzFJvDbvj7p2a505ouFJwf6coyVAey/ h/H9H2ODeObk7eRID8282xITAymXKQg2ntDAZ5XESVCsvlAzA0h9VfoJbbrm5eKGEle1 7iiuZB4N7Vsr+/+UoJspdMipc11PcIoaRFmqFDQAQWgv7sq8eSBXnVXareMXl7u2yRU8 PRuDU3dyQt4dutTIF8iS/ZPu6u9qeaR4fiZUhkOhTJbbj6hGPZeirhTyCBfsfvoQqSJR 0LSA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r7si13107696edt.237.2021.03.16.00.14.49; Tue, 16 Mar 2021 00:15:19 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231668AbhCPCAY (ORCPT + 99 others); Mon, 15 Mar 2021 22:00:24 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13957 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234013AbhCPB7x (ORCPT ); Mon, 15 Mar 2021 21:59:53 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DzxJK6Gw0zrWkd; Tue, 16 Mar 2021 09:57:53 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Tue, 16 Mar 2021 09:59:35 +0800 From: chenxiang To: , , , , CC: , , Xiang Chen Subject: [PATCH v2 2/4] crypto: cavium - Fix the parameter of dma_unmap_sg() Date: Tue, 16 Mar 2021 09:55:24 +0800 Message-ID: <1615859726-57062-3-git-send-email-chenxiang66@hisilicon.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1615859726-57062-1-git-send-email-chenxiang66@hisilicon.com> References: <1615859726-57062-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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c index 53ef067..df95ba2 100644 --- a/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c +++ b/drivers/crypto/cavium/nitrox/nitrox_reqmgr.c @@ -58,14 +58,15 @@ static void softreq_unmap_sgbufs(struct nitrox_softreq *sr) struct device *dev = DEV(ndev); - dma_unmap_sg(dev, sr->in.sg, sr->in.sgmap_cnt, DMA_BIDIRECTIONAL); + dma_unmap_sg(dev, sr->in.sg, sg_nents(sr->in.sg), + DMA_BIDIRECTIONAL); dma_unmap_single(dev, sr->in.sgcomp_dma, sr->in.sgcomp_len, DMA_TO_DEVICE); kfree(sr->in.sgcomp); sr->in.sg = NULL; sr->in.sgmap_cnt = 0; - dma_unmap_sg(dev, sr->out.sg, sr->out.sgmap_cnt, + dma_unmap_sg(dev, sr->out.sg, sg_nents(sr->out.sg), DMA_BIDIRECTIONAL); dma_unmap_single(dev, sr->out.sgcomp_dma, sr->out.sgcomp_len, DMA_TO_DEVICE); @@ -178,7 +179,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; } @@ -203,7 +204,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