From patchwork Fri Aug 14 14:24:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tadeusz Struk X-Patchwork-Id: 7015441 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 434D9C05AD for ; Fri, 14 Aug 2015 14:26:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7153F207EB for ; Fri, 14 Aug 2015 14:26:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0EA79207E5 for ; Fri, 14 Aug 2015 14:26:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751962AbbHNO03 (ORCPT ); Fri, 14 Aug 2015 10:26:29 -0400 Received: from mga02.intel.com ([134.134.136.20]:43799 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751429AbbHNO02 (ORCPT ); Fri, 14 Aug 2015 10:26:28 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 14 Aug 2015 07:25:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,678,1432623600"; d="scan'208";a="625527942" Received: from ikadim-mobl.amr.corp.intel.com (HELO tstruk-mobl1.intel.com) ([10.254.51.15]) by orsmga003.jf.intel.com with ESMTP; 14 Aug 2015 07:25:33 -0700 Message-ID: <55CDFA17.3090100@intel.com> Date: Fri, 14 Aug 2015 07:24:23 -0700 From: Tadeusz Struk User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Herbert Xu CC: keescook@chromium.org, jwboyer@redhat.com, smueller@chronox.de, richard@nod.at, steved@redhat.com, linux-kernel@vger.kernel.org, dhowells@redhat.com, linux-crypto@vger.kernel.org, james.l.morris@oracle.com, jkosina@suse.cz, zohar@linux.vnet.ibm.com, davem@davemloft.net, vgoyal@redhat.com Subject: Re: [PATCH 2/2] crypto: qat - Don't move data inside output buffer References: <20150813035433.25108.3065.stgit@tstruk-mobl1> <20150813035445.25108.76927.stgit@tstruk-mobl1> <20150814051410.GA2370@gondor.apana.org.au> <55CD8733.2000904@intel.com> <20150814062636.GA2799@gondor.apana.org.au> In-Reply-To: <20150814062636.GA2799@gondor.apana.org.au> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 08/13/2015 11:26 PM, Herbert Xu wrote: > On Thu, Aug 13, 2015 at 11:14:11PM -0700, Tadeusz Struk wrote: >> >> Right, but we don't need that anymore. > > Why not? If you reduce the size without moving the buffer wouldn't > it begin with a bunch of zeroes and wouldn't you lose the real bytes > at the end? > If you don't like the first option then we still need this, as you pointed out. ---8<--- Change memcpy to memmove because the copy is done within the same buffer. Signed-off-by: Tadeusz Struk --- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c index fe352a6..e87f510 100644 --- a/drivers/crypto/qat/qat_common/qat_asym_algs.c +++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c @@ -145,7 +145,7 @@ static void qat_rsa_cb(struct icp_qat_fw_pke_resp *resp) } if (areq->dst_len != req->ctx->key_sz) - memcpy(areq->dst, ptr, areq->dst_len); + memmove(areq->dst, ptr, areq->dst_len); akcipher_request_complete(areq, err); }