From patchwork Wed Jun 8 12:56:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 9164531 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4619C60467 for ; Wed, 8 Jun 2016 12:57:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 377E328179 for ; Wed, 8 Jun 2016 12:57:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C3AD2823D; Wed, 8 Jun 2016 12:57:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD0E928179 for ; Wed, 8 Jun 2016 12:57:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161798AbcFHM5B (ORCPT ); Wed, 8 Jun 2016 08:57:01 -0400 Received: from mail-lf0-f45.google.com ([209.85.215.45]:35142 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161222AbcFHM5A (ORCPT ); Wed, 8 Jun 2016 08:57:00 -0400 Received: by mail-lf0-f45.google.com with SMTP id u74so5172181lff.2 for ; Wed, 08 Jun 2016 05:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=nbGsmOFFgCUPPZKsSlEB0enfQFHJ6jHiLa16y3wqtF0=; b=DTaprFEDaSRpFNpHG+tK6e5tvWhUNWn4UkwMaN4DAnC0qPUPcTHQOZjzRQ0Y2iW66E JM8zz7qDoig98J4XkorwoJMqvFAqFjXtA8kbRtV0Y8I/S9MjDU1py5yMOqskGJr0uF2k f3uuMPEj6mgtdbAgcfPwnQh36ejO/d1PQRlUc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=nbGsmOFFgCUPPZKsSlEB0enfQFHJ6jHiLa16y3wqtF0=; b=fvi1QJiRWkAGxWTRI1KMPKNU9vZaXtBxaoYSicBF8gD4LK5sC1ohf0A3+1FCgH+xhd JRLCp8a/qhKUPP2qLxzQZEgH1UipX0+zOg6CLRx0fzJaVgqbvUgMdI8DvQaYJNcJ8xpl mzARNVOkcx902IstX9TSz07ocXmB7G4g3zf8NS1RUe7KffO804pe+BBY6B9bEn0bv0X7 eU/LG2m1D1ExGI5NXMvU+reDGEC5ldWSjm5SFN5LNycyhtsAmX5TvKeoUWInP1jDadlI 7xQ+5XfAEiH1AHGRinu8teGqT2SybxPZQi6BzqidcGwCVsbC+mV++sjFTI5ETEw2mHSs TbIw== X-Gm-Message-State: ALyK8tLhh0pdujvAysYpMZcPpL0IYhRw4OnH/iuxMJz/3bR2yxwCk2TxiN+MoKBMHWYSEU0G X-Received: by 10.25.85.144 with SMTP id j138mr4784860lfb.37.1465390618745; Wed, 08 Jun 2016 05:56:58 -0700 (PDT) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h95sm135543lji.34.2016.06.08.05.56.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jun 2016 05:56:57 -0700 (PDT) From: Linus Walleij To: linux-crypto@vger.kernel.org, Herbert Xu Cc: David Binderman , Linus Walleij , Joakim Bech Subject: [PATCH] crypto: ux500: memmove the right size Date: Wed, 8 Jun 2016 14:56:39 +0200 Message-Id: <1465390599-20605-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.11 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The hash buffer is really HASH_BLOCK_SIZE bytes, someone must have thought that memmove takes n*u32 words by mistake. Tests work as good/bad as before after this patch. Cc: Joakim Bech Reported-by: David Binderman Signed-off-by: Linus Walleij --- drivers/crypto/ux500/hash/hash_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 574e87c7f2b8..9acccad26928 100644 --- a/drivers/crypto/ux500/hash/hash_core.c +++ b/drivers/crypto/ux500/hash/hash_core.c @@ -781,7 +781,7 @@ static int hash_process_data(struct hash_device_data *device_data, &device_data->state); memmove(req_ctx->state.buffer, device_data->state.buffer, - HASH_BLOCK_SIZE / sizeof(u32)); + HASH_BLOCK_SIZE); if (ret) { dev_err(device_data->dev, "%s: hash_resume_state() failed!\n", @@ -832,7 +832,7 @@ static int hash_process_data(struct hash_device_data *device_data, memmove(device_data->state.buffer, req_ctx->state.buffer, - HASH_BLOCK_SIZE / sizeof(u32)); + HASH_BLOCK_SIZE); if (ret) { dev_err(device_data->dev, "%s: hash_save_state() failed!\n", __func__);