From patchwork Mon May 11 17:04:22 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: 6379501 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 A8C499F32E for ; Mon, 11 May 2015 17:18:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CFB82208D2 for ; Mon, 11 May 2015 17:18:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 49E7D208CF for ; Mon, 11 May 2015 17:18:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751806AbbEKRSz (ORCPT ); Mon, 11 May 2015 13:18:55 -0400 Received: from mail-bn1bbn0104.outbound.protection.outlook.com ([157.56.111.104]:49072 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751413AbbEKRSy (ORCPT ); Mon, 11 May 2015 13:18:54 -0400 Received: from CH1PR03CA003.namprd03.prod.outlook.com (10.255.156.148) by BY1PR0301MB1303.namprd03.prod.outlook.com (25.161.206.152) with Microsoft SMTP Server (TLS) id 15.1.148.16; Mon, 11 May 2015 17:04:46 +0000 Received: from BL2FFO11FD027.protection.gbl (10.255.156.132) by CH1PR03CA003.outlook.office365.com (10.255.156.148) with Microsoft SMTP Server (TLS) id 15.1.154.19 via Frontend Transport; Mon, 11 May 2015 17:04:45 +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 BL2FFO11FD027.mail.protection.outlook.com (10.173.161.106) with Microsoft SMTP Server (TLS) id 15.1.160.8 via Frontend Transport; Mon, 11 May 2015 17:04:45 +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 t4BH4erM026706; Mon, 11 May 2015 10:04:41 -0700 From: Horia Geanta To: Herbert Xu CC: Wei Yongjun , , "David S. Miller" Subject: [PATCH 2/4] Revert "crypto: talitos - convert to use be16_add_cpu()" Date: Mon, 11 May 2015 20:04:22 +0300 Message-ID: <1431363862-2470-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)(189002)(199003)(86362001)(47776003)(575784001)(19580395003)(62966003)(2950100001)(50466002)(92566002)(77096005)(229853001)(33646002)(77156002)(50986999)(48376002)(76176999)(104016003)(85426001)(19580405001)(87936001)(189998001)(6806004)(110136002)(106466001)(105606002)(36756003)(46102003)(50226001)(5001960100002); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0301MB1303; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1303; 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:BY1PR0301MB1303; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0301MB1303; X-Forefront-PRVS: 05739BA1B5 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2015 17:04:45.4098 (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: BY1PR0301MB1303 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 This reverts commit 7291a932c6e27d9768e374e9d648086636daf61c. The conversion to be16_add_cpu() is incorrect in case cryptlen is negative due to premature (i.e. before addition / subtraction) implicit conversion of cryptlen (int -> u16) leading to sign loss. Cc: # 3.10+ Cc: Wei Yongjun Signed-off-by: Horia Geanta --- drivers/crypto/talitos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 2c2ec0e0c145..6b19b3dca616 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -1083,7 +1083,8 @@ static int sg_to_link_tbl(struct scatterlist *sg, int sg_count, sg_count--; link_tbl_ptr--; } - be16_add_cpu(&link_tbl_ptr->len, cryptlen); + link_tbl_ptr->len = cpu_to_be16(be16_to_cpu(link_tbl_ptr->len) + + cryptlen); /* tag end of link table */ link_tbl_ptr->j_extent = DESC_PTR_LNKTBL_RETURN;