crypto: padlock-aes - use offset_in_page macro
authorGeliang Tang <geliangtang@163.com>
Sat, 21 Nov 2015 14:24:11 +0000 (22:24 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 24 Nov 2015 10:19:19 +0000 (18:19 +0800)
Use offset_in_page macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/padlock-aes.c

index da2d6777bd092f0a373e14cc960514b8a4f5d148..be2dd1096d65533b68cc0a18a5b77e96b3901383 100644 (file)
@@ -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);