From patchwork Mon May 11 17:04:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Horia_Geant=C4=83?= X-Patchwork-Id: 6379511 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 9B6469F32E for ; Mon, 11 May 2015 17:20:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FA572011D for ; Mon, 11 May 2015 17:20:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BC8E20117 for ; Mon, 11 May 2015 17:20:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751096AbbEKRUt (ORCPT ); Mon, 11 May 2015 13:20:49 -0400 Received: from mail-bl2on0119.outbound.protection.outlook.com ([65.55.169.119]:55808 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751039AbbEKRUt (ORCPT ); Mon, 11 May 2015 13:20:49 -0400 Received: from BN3PR0301CA0014.namprd03.prod.outlook.com (25.160.180.152) by BY1PR0301MB1301.namprd03.prod.outlook.com (25.161.206.150) with Microsoft SMTP Server (TLS) id 15.1.148.16; Mon, 11 May 2015 17:05:03 +0000 Received: from BL2FFO11OLC014.protection.gbl (2a01:111:f400:7c09::171) by BN3PR0301CA0014.outlook.office365.com (2a01:111:e400:4000::24) with Microsoft SMTP Server (TLS) id 15.1.160.19 via Frontend Transport; Mon, 11 May 2015 17:05:02 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; davemloft.net; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BL2FFO11OLC014.mail.protection.outlook.com (10.173.160.144) with Microsoft SMTP Server (TLS) id 15.1.160.8 via Frontend Transport; Mon, 11 May 2015 17:05:01 +0000 Received: from enigma.ea.freescale.net (enigma.ea.freescale.net [10.171.77.120]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t4BH4xvO026740; Mon, 11 May 2015 10:04:59 -0700 From: Horia Geanta To: Herbert Xu CC: , "David S. Miller" Subject: [PATCH 4/4] crypto: talitos - static code checker fixes Date: Mon, 11 May 2015 20:04:56 +0300 Message-ID: <1431363896-2745-1-git-send-email-horia.geanta@freescale.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1431363804-2331-1-git-send-email-horia.geanta@freescale.com> References: <1431363804-2331-1-git-send-email-horia.geanta@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(199003)(189002)(50466002)(106466001)(46102003)(50226001)(86362001)(229853001)(50986999)(105606002)(104016003)(48376002)(87936001)(33646002)(19580395003)(6806004)(36756003)(5001960100002)(5001920100001)(47776003)(85426001)(575784001)(76176999)(19580405001)(77096005)(62966003)(189998001)(92566002)(77156002)(110136002)(2950100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0301MB1301; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1301; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BY1PR0301MB1301; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0301MB1301; X-Forefront-PRVS: 05739BA1B5 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2015 17:05:01.8451 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1301 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 -change req_ctx->nbuf from u64 to unsigned int to silence checker warnings; this is safe since nbuf value is <= HASH_MAX_BLOCK_SIZE -remove unused value read from TALITOS_CCPSR; there is no requirement to read upper 32b before reading lower 32b of a 64b register; SEC RM mentions: "reads can always be done by byte, word, or dword" -remove unused return value of sg_to_link_tbl() -change "len" parameter of map_single_talitos_ptr() and to_talitos_ptr_len() to unsigned int; later, cpu_to_be16 will __force downcast the value to unsigned short without any checker warning Signed-off-by: Horia Geanta --- drivers/crypto/talitos.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 7367f6cba2ed..cb183b0b8578 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -63,7 +63,7 @@ static void to_talitos_ptr(struct talitos_ptr *ptr, dma_addr_t dma_addr, ptr->eptr = upper_32_bits(dma_addr); } -static void to_talitos_ptr_len(struct talitos_ptr *ptr, unsigned short len, +static void to_talitos_ptr_len(struct talitos_ptr *ptr, unsigned int len, bool is_sec1) { if (is_sec1) { @@ -94,7 +94,7 @@ static void to_talitos_ptr_extent_clear(struct talitos_ptr *ptr, bool is_sec1) */ static void map_single_talitos_ptr(struct device *dev, struct talitos_ptr *ptr, - unsigned short len, void *data, + unsigned int len, void *data, enum dma_data_direction dir) { dma_addr_t dma_addr = dma_map_single(dev, data, len, dir); @@ -543,7 +543,7 @@ static void talitos_error(struct device *dev, u32 isr, u32 isr_lo) struct talitos_private *priv = dev_get_drvdata(dev); unsigned int timeout = TALITOS_TIMEOUT; int ch, error, reset_dev = 0; - u32 v, v_lo; + u32 v_lo; bool is_sec1 = has_ftr_sec1(priv); int reset_ch = is_sec1 ? 1 : 0; /* only SEC2 supports continuation */ @@ -560,7 +560,6 @@ static void talitos_error(struct device *dev, u32 isr, u32 isr_lo) error = -EINVAL; - v = in_be32(priv->chan[ch].reg + TALITOS_CCPSR); v_lo = in_be32(priv->chan[ch].reg + TALITOS_CCPSR_LO); if (v_lo & TALITOS_CCPSR_LO_DOF) { @@ -815,7 +814,7 @@ struct talitos_ahash_req_ctx { unsigned int first; unsigned int last; unsigned int to_hash_later; - u64 nbuf; + unsigned int nbuf; struct scatterlist bufsl[2]; struct scatterlist *psrc; }; @@ -1639,8 +1638,7 @@ void map_sg_out_talitos_ptr(struct device *dev, struct scatterlist *dst, (edesc->src_nents + 1) * sizeof(struct talitos_ptr), 0); ptr->j_extent |= DESC_PTR_LNKTBL_JUMP; - sg_count = sg_to_link_tbl(dst, sg_count, len, - link_tbl_ptr); + sg_to_link_tbl(dst, sg_count, len, link_tbl_ptr); dma_sync_single_for_device(dev, edesc->dma_link_tbl, edesc->dma_len, DMA_BIDIRECTIONAL);