From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45FFFC49EA6 for ; Thu, 24 Jun 2021 06:56:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E25461374 for ; Thu, 24 Jun 2021 06:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbhFXG7J (ORCPT ); Thu, 24 Jun 2021 02:59:09 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:50838 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbhFXG7I (ORCPT ); Thu, 24 Jun 2021 02:59:08 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtp (Exim 4.92 #5 (Debian)) id 1lwJI9-0005XX-4v; Thu, 24 Jun 2021 14:56:49 +0800 Received: from herbert by gondobar with local (Exim 4.92) (envelope-from ) id 1lwJI4-0002aO-DS; Thu, 24 Jun 2021 14:56:44 +0800 Date: Thu, 24 Jun 2021 14:56:44 +0800 From: Herbert Xu To: Sean Anderson Cc: linux-crypto@vger.kernel.org, "David S . Miller" , Aymen Sghaier , linux-arm-kernel@lists.infradead.org, Marek Vasut , Horia =?utf-8?Q?Geant=C4=83?= Subject: Re: [PATCH 2/2] crypto: mxs_dcp: Use sg_mapping_iter to copy data Message-ID: <20210624065644.GA7826@gondor.apana.org.au> References: <20210618211411.1167726-1-sean.anderson@seco.com> <20210618211411.1167726-2-sean.anderson@seco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210618211411.1167726-2-sean.anderson@seco.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Jun 18, 2021 at 05:14:11PM -0400, Sean Anderson wrote: > This uses the sg_miter_*() functions to copy data, instead of doing it > ourselves. Using sg_copy_buffer() would be better, but this way we don't > have to keep traversing the beginning of the scatterlist every time we > do another copy. > > In addition to reducing code size, this fixes the following oops > resulting from failing to kmap the page: Thanks for the patch. Just a minor nit: > @@ -365,25 +364,13 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) > > out_tmp = out_buf; > last_out_len = actx->fill; > - while (dst && actx->fill) { > - if (!split) { > - dst_buf = sg_virt(dst); > - dst_off = 0; > - } > - rem = min(sg_dma_len(dst) - dst_off, > - actx->fill); > - > - memcpy(dst_buf + dst_off, out_tmp, rem); > + > + while (sg_miter_next(&dst_iter) && actx->fill) { > + rem = min(dst_iter.length, actx->fill); This comparison generates a sparse warning due to conflicting types, please fix this and resubmit. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFA87C48BDF for ; Thu, 24 Jun 2021 06:58:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7DA94613CC for ; Thu, 24 Jun 2021 06:58:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DA94613CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gondor.apana.org.au Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IzbRXcQSBIIsHwpxUcK0mtkP8gV+PRytVG4Qzy+4Aaw=; b=vRfkaiQdM/xKvJ +sDhO85aJC0/hefgAYGBFh+UpyopetA4Tuy/hkC8/KCxdyzE++XEPO04kKigfnKTm8Hq6C9VTjRqr KtbOGdISj8Pxo4yoT5qdo1j1VOOfFJCT1oAlxZsYFzZ+0C9HxNB6wHiXtsKbBJMpHgC3c8Ra59g/D bOGwKl9jPsAOdrLbxBwLNrzd/UCsjv31CnG5SS7BNqRaXrpGshuhbz4WuvQSOeyEwYROp7YG4cqMn UaLuhNNCkJYrJ4PAsJ7U713a9wLnJVzGBDgO4kuOLVx8ja45VfJOWIOIpwDxZP2X0N6xZVoexmMZS yfgfUdN1bh7qx9lWBWCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwJIJ-00D4Np-0w; Thu, 24 Jun 2021 06:56:59 +0000 Received: from helcar.hmeau.com ([216.24.177.18] helo=deadmen.hmeau.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwJIF-00D4Mu-5w for linux-arm-kernel@lists.infradead.org; Thu, 24 Jun 2021 06:56:56 +0000 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtp (Exim 4.92 #5 (Debian)) id 1lwJI9-0005XX-4v; Thu, 24 Jun 2021 14:56:49 +0800 Received: from herbert by gondobar with local (Exim 4.92) (envelope-from ) id 1lwJI4-0002aO-DS; Thu, 24 Jun 2021 14:56:44 +0800 Date: Thu, 24 Jun 2021 14:56:44 +0800 From: Herbert Xu To: Sean Anderson Cc: linux-crypto@vger.kernel.org, "David S . Miller" , Aymen Sghaier , linux-arm-kernel@lists.infradead.org, Marek Vasut , Horia =?utf-8?Q?Geant=C4=83?= Subject: Re: [PATCH 2/2] crypto: mxs_dcp: Use sg_mapping_iter to copy data Message-ID: <20210624065644.GA7826@gondor.apana.org.au> References: <20210618211411.1167726-1-sean.anderson@seco.com> <20210618211411.1167726-2-sean.anderson@seco.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210618211411.1167726-2-sean.anderson@seco.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210623_235655_265420_64263478 X-CRM114-Status: GOOD ( 14.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jun 18, 2021 at 05:14:11PM -0400, Sean Anderson wrote: > This uses the sg_miter_*() functions to copy data, instead of doing it > ourselves. Using sg_copy_buffer() would be better, but this way we don't > have to keep traversing the beginning of the scatterlist every time we > do another copy. > > In addition to reducing code size, this fixes the following oops > resulting from failing to kmap the page: Thanks for the patch. Just a minor nit: > @@ -365,25 +364,13 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) > > out_tmp = out_buf; > last_out_len = actx->fill; > - while (dst && actx->fill) { > - if (!split) { > - dst_buf = sg_virt(dst); > - dst_off = 0; > - } > - rem = min(sg_dma_len(dst) - dst_off, > - actx->fill); > - > - memcpy(dst_buf + dst_off, out_tmp, rem); > + > + while (sg_miter_next(&dst_iter) && actx->fill) { > + rem = min(dst_iter.length, actx->fill); This comparison generates a sparse warning due to conflicting types, please fix this and resubmit. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel