From patchwork Fri Jul 24 14:04:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ahmed Soliman X-Patchwork-Id: 6860741 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 43B5CC05AC for ; Fri, 24 Jul 2015 14:04:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 64EED20569 for ; Fri, 24 Jul 2015 14:04:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 16BD92055A for ; Fri, 24 Jul 2015 14:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753339AbbGXOEi (ORCPT ); Fri, 24 Jul 2015 10:04:38 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:34699 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752552AbbGXOEh (ORCPT ); Fri, 24 Jul 2015 10:04:37 -0400 Received: by wibud3 with SMTP id ud3so66822042wib.1; Fri, 24 Jul 2015 07:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:content-type:mime-version :content-transfer-encoding; bh=gtkeZ/0BQIQBNzetdm3R/dX0lXwDv5+y7Wn/uVLs8m8=; b=H/j+k3TUoFwt1R88tsytE/wBc9bOFJ+bJEiC58KPR69YfPYePeqHvFc3WLqhApT/pV gF3+vPrPalk5oWPqDEA0UCbnnPydLLRdhSUHp3Uwm6nvo9ctLcuiPUrIlbDZHbdb/Zsr eYZanJJeyI5he73nzH6egrETolLQDe42N/2YckESWbN7xolLZ7hqo3yVTNcfueuu1TKa vD1++nIHLcx5sC6KF7uYfBl5g1Zk1twNyA4lY7tJetwV8ITHL7Lmk5vek4dviw9Iv7Lh UPJ5TLCrpq16RzfAIm4fq25He7Dz0lHMbDudsYBFAsUmxtoueq9weGqoltqEy7nMETCR Pq+Q== X-Received: by 10.194.63.42 with SMTP id d10mr29860352wjs.92.1437746675916; Fri, 24 Jul 2015 07:04:35 -0700 (PDT) Received: from [192.168.1.4] ([41.234.164.160]) by smtp.googlemail.com with ESMTPSA id qq1sm12852046wjc.0.2015.07.24.07.04.34 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2015 07:04:35 -0700 (PDT) Message-ID: <1437746672.19489.2.camel@My-Computer> Subject: [PATCH] code cleanups for crypto/blkcipher.c From: Ahmed Mohamed Abd EL Mawgood To: herbert@gondor.apana.org.au, davem@davemloft.net Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 24 Jul 2015 16:04:32 +0200 X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, 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 fixing all errors and most warning of checkpatch.pl for crypto/blkcipher.c Signed-off-by: Ahmed Mohamed --- crypto/blkcipher.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 11b9814..4530ff9 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c @@ -1,6 +1,6 @@ /* * Block chaining cipher operations. - * + * * Generic encrypt/decrypt wrapper for ciphers, handles operations across * multiple page boundaries by using temporary blocks. In user context, * the kernel is given a chance to schedule us once per page. @@ -9,7 +9,7 @@ * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) + * Software Foundation; either version 2 of the License, or (at your option) * any later version. * */ @@ -68,6 +68,7 @@ static inline void blkcipher_unmap_dst(struct blkcipher_walk *walk) static inline u8 *blkcipher_get_spot(u8 *start, unsigned int len) { u8 *end_page = (u8 *)(((unsigned long)(start + len - 1)) & PAGE_MASK); + return max(start, end_page); } @@ -334,6 +335,7 @@ static int blkcipher_walk_first(struct blkcipher_desc *desc, walk->iv = desc->info; if (unlikely(((unsigned long)walk->iv & walk->alignmask))) { int err = blkcipher_copy_iv(walk); + if (err) return err; } @@ -541,7 +543,7 @@ static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg) __attribute__ ((unused)); static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg) { - seq_printf(m, "type : blkcipher\n"); + seq_puts(m, "type : blkcipher"); seq_printf(m, "blocksize : %u\n", alg->cra_blocksize); seq_printf(m, "min keysize : %u\n", alg->cra_blkcipher.min_keysize); seq_printf(m, "max keysize : %u\n", alg->cra_blkcipher.max_keysize); @@ -567,7 +569,7 @@ static int crypto_grab_nivcipher(struct crypto_skcipher_spawn *spawn, int err; type = crypto_skcipher_type(type); - mask = crypto_skcipher_mask(mask)| CRYPTO_ALG_GENIV; + mask = crypto_skcipher_mask(mask) | CRYPTO_ALG_GENIV; alg = crypto_alg_mod_lookup(name, type, mask); if (IS_ERR(alg))