Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp339813pxj; Wed, 23 Jun 2021 23:58:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzA9igz+ulBFKyzZTcZ3sHyK424uZHoxY6k19rA7iAYZyq/RqF38lIaj/mva5u2VnjpXNa0 X-Received: by 2002:a17:906:39d7:: with SMTP id i23mr3761778eje.121.1624517921672; Wed, 23 Jun 2021 23:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624517921; cv=none; d=google.com; s=arc-20160816; b=Akkk6cLD2+i91KPglsby2oEb0M0OKc66nBjx3ZS6eu+7XOKS7hJHz4ivEOEUIvWHN5 OCrR5sXgsvZ4l59ItHhXqWafJbbm75vr01tHHp46Yiy/F6wDdg4vpMAS2lNRp3FzoJoH FFTvynhXJIqs0yApxSGHKCKwRgQ3phwciGtikN/H569kJL234GxPUksT+SHWUdYOyj+H Yf5fOOwkS9SYaAc/7tUT3A5L2Fn0BhiC/5K7/Q9l2/j4zmbMocqfkWAASs6Yy0I+5b6z LB56IOVBUldB+JSZ1FlIx27hsNFlUp/27rU0yLRc05i9uveZamlOUiIS9omnBWJI3I5j z2MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=CE2neBYsoIi5VLw6vQu8FOPMAsWEb5K3hD2M7e+oixA=; b=a4thGK9k7SyDzKypMP6vBXS4/13ZGyzGUGXlW54mUou3CpXqMGfuHzwXW+PiYKc8LR P9KNFAhmUtoORyQEHzx01MGiUqkWxedFadHegYnVDFoUo1L98HgvdhsRdy9iAY00vsc3 9ddfSLZUQnWi1PmgA+j5HLWxYwQewJ4mZCUJK/O8etmiSslre/bP1xiFMcuLHu93LmdR RJhfIuiOT7q2QiIai6NkByNjP6GFisKk+1q26wyDAjaDkFa9V1vhnLU17tetH4yN7KVu ojJbsbV2Y1XRMzm3KBnE8HaVtE9wrj5E1Ye5RMsK2vZPjvK0epciXMW2IaVWu3vw3wxD K/XA== 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 el21si2333208ejc.403.2021.06.23.23.58.09; Wed, 23 Jun 2021 23:58:41 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbhFXG7J (ORCPT + 99 others); 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