From patchwork Sat Nov 21 14:24:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 7674451 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D6E409F1C2 for ; Sat, 21 Nov 2015 14:25:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 03E4F20653 for ; Sat, 21 Nov 2015 14:25:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A18AF2064C for ; Sat, 21 Nov 2015 14:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752076AbbKUOZW (ORCPT ); Sat, 21 Nov 2015 09:25:22 -0500 Received: from m50-133.163.com ([123.125.50.133]:49360 "EHLO m50-133.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751720AbbKUOZV (ORCPT ); Sat, 21 Nov 2015 09:25:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=UObdgqUiPjCORALcbz oXNawmb52lRb7E8/X31yt4J2k=; b=NuuAFI9MC/NNkrCUqs4KqspDeq7SFhm+UJ lIZJfwY0p68tD6Zm3D60SW04Y1YMkS9tJdBJyxK0Kz6drTJnIOqGJBgA32SqueED 2DM251sCIUpa72DHj/M4ppV4x1vVcWFcmnRA2RW8GUF8Tk9zw2WhjnT8G5+Uj4UV fTzOttwbk= Received: from localhost (unknown [115.45.185.14]) by smtp3 (Coremail) with SMTP id DdGowEAp7XCRflBW8mp3AQ--.12426S3; Sat, 21 Nov 2015 22:24:18 +0800 (CST) From: Geliang Tang To: Herbert Xu , "David S. Miller" Cc: Geliang Tang , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: padlock-aes - use offset_in_page macro Date: Sat, 21 Nov 2015 22:24:11 +0800 Message-Id: <19b0bc324e0d893c4b516f3873b6dcbcff0da6ea.1448115766.git.geliangtang@163.com> X-Mailer: git-send-email 2.5.0 X-CM-TRANSID: DdGowEAp7XCRflBW8mp3AQ--.12426S3 X-Coremail-Antispam: 1Uf129KBjvJXoWxJrWfCFW3KrWkuw17AFyrWFg_yoW8Jw1UpF W5K3yqyF1Iy3429F48GFn5JFyFq3sxAFWakFsF9w1DZay3ZFyrGay7Cr1avr48Gr4rZFZ0 gF4jqr1Y9F1kA3JanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07Uc_-QUUUUU= X-Originating-IP: [115.45.185.14] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiowC5mVUL22B-KgABsy 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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 Use offset_in_page macro instead of (addr & ~PAGE_MASK). Signed-off-by: Geliang Tang --- drivers/crypto/padlock-aes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index da2d677..be2dd10 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c @@ -238,7 +238,7 @@ static inline void ecb_crypt(const u8 *in, u8 *out, u32 *key, /* Padlock in ECB mode fetches at least ecb_fetch_bytes of data. * We could avoid some copying here but it's probably not worth it. */ - if (unlikely(((unsigned long)in & ~PAGE_MASK) + ecb_fetch_bytes > PAGE_SIZE)) { + if (unlikely(offset_in_page(in) + ecb_fetch_bytes > PAGE_SIZE)) { ecb_crypt_copy(in, out, key, cword, count); return; } @@ -250,7 +250,7 @@ static inline u8 *cbc_crypt(const u8 *in, u8 *out, u32 *key, u8 *iv, struct cword *cword, int count) { /* Padlock in CBC mode fetches at least cbc_fetch_bytes of data. */ - if (unlikely(((unsigned long)in & ~PAGE_MASK) + cbc_fetch_bytes > PAGE_SIZE)) + if (unlikely(offset_in_page(in) + cbc_fetch_bytes > PAGE_SIZE)) return cbc_crypt_copy(in, out, key, iv, cword, count); return rep_xcrypt_cbc(in, out, key, iv, cword, count);