From patchwork Thu Nov 24 11:04:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gao Pan X-Patchwork-Id: 9445223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 33EBF60778 for ; Thu, 24 Nov 2016 11:07:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FFF927CF5 for ; Thu, 24 Nov 2016 11:07:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24B0127D76; Thu, 24 Nov 2016 11:07:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A68B527D45 for ; Thu, 24 Nov 2016 11:07:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938696AbcKXLHm (ORCPT ); Thu, 24 Nov 2016 06:07:42 -0500 Received: from mail-db5eur01on0083.outbound.protection.outlook.com ([104.47.2.83]:20832 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S936026AbcKXLHj (ORCPT ); Thu, 24 Nov 2016 06:07:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=g4O3YeDrLuzwW+SBr98wTJV7umujA5tA3kZTflxwTF4=; b=v3BuO4juiJH9y5A/VQ8Un+V5kDkrgfSyg4V/yUhwsDyURybgXfvzOWsvi1VSK+MC/EIVbpjjVPcZu8gQsVuctMxsmblCFR/pPD6DbIDkLS2Y1+K3IPJt+3q2SUuax5ty4wooWGVwiGNxV6OwbDjP0KMZLvCj952rFtXHjQ350WI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pandy.gao@nxp.com; Received: from b54642-OptiPlex-3020.ap.freescale.net (199.59.225.131) by AM4PR0401MB1778.eurprd04.prod.outlook.com (10.165.244.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.10; Thu, 24 Nov 2016 11:06:02 +0000 From: Gao Pan To: CC: , , , Subject: [Patch V1 2/3] spi: imx: fix potential shift truncation Date: Thu, 24 Nov 2016 19:04:43 +0800 Message-ID: <1479985484-6641-2-git-send-email-pandy.gao@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1479985484-6641-1-git-send-email-pandy.gao@nxp.com> References: <1479985484-6641-1-git-send-email-pandy.gao@nxp.com> MIME-Version: 1.0 X-Originating-IP: [199.59.225.131] X-ClientProxiedBy: SG2PR01CA0040.apcprd01.prod.exchangelabs.com (10.165.9.178) To AM4PR0401MB1778.eurprd04.prod.outlook.com (10.165.244.148) X-MS-Office365-Filtering-Correlation-Id: e3e44424-81e0-4b47-e909-08d41459e36f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:AM4PR0401MB1778; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB1778; 3:R+jaWJiB7gaU981Z+dFjsx3H3PgLe5h8h9KplMsBGC4zSfnJXpudb6s1ALnKkMQku6v2IQe/PtEdqxMF6+OwCBAJV0uej3GCwaMRyfeekVThoKJvd+ivLim8hfp+gHOLze85kD5jDdYCfunw+KfROwuMARQbXXCYPtnWvMivSxsEfpr0f6jqf2+SjCnXR5Cu6O6oT0+bDW3Jhh6zbfHHOZGj8CjE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8cmhV66qU0G8l1DWLh57GkOQHvL4RFHzhkDp+6QbtWEgYRGbhDuVCHCo6ePbfHxHL03s8A1eSpOfzS0E31BWBiXBiKZU0Im8VWG5uAmg; 20:ALvWS514z5VE05aJBoDYh6Hc3VW5OD6/JjypyrY7Ny3zLbsejgO8AMb7SIZT7hdJsWFVBqrZCCLe03EITVCeigKACU+0REL/O6hEstHzm+FZhb6Pzk7rnHDvSZcP+Xr/3XENfcgk6VrxzYZE9GyMDBZ7gqvZN+eCjvOv85yncnLaKRa9WZEN+73M72rZN9kOF1y31H1fHe0zxRuSkjzXnAu/aRW06GLxw0QwQDFh33cl3ZdVjIiRvxgFoAeVUoenTiBbyBFoczwLbEHyWAfeQ/6j4/HRJLuOX6WjW/YNChu1rlS2u6RiBIrVmapOzjy2w1P6WPsDki+Njq988bh85BGdw1lCYRxRGsccf5iFiSgvaNa6LXYy5/1QcGSHcKIzKqMJho6nrvGTMmT3Mn5NgAcXxwGRsV6hiP20HeEMIZsANQFnfs7jvWgIoYmgkPK2sB3N4vLQIKOOYwA+1NKyF31Dj/O65qqDGdDk5qad0m23OxBgPWf/D5yl1AmMSx8v X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6060326)(6045199)(6040361)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6046074)(6061324)(6041248)(20161123555025)(20161123564025)(20161123560025)(20161123562025); SRVR:AM4PR0401MB1778; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0401MB1778; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB1778; 4:iSHe9MXmgsBrdCI4yK81YlzgScs5oowTupVGLR9cQbOun2p70bZitcQPnps72EbBSdVru8Blewh6YEVmGm+V+YcjbmJvlky/jd3UNA/zvmCmdJbAoik7Mr7w9tUNob6r8tQSj2Lsd+JWW1NvT2j3+7pHgbjwVp9svsc7gAjhDGmh4nfTy2ArfRkoCY8msEV9NkckS+oeKQ/Jd34Bo1+NuHq0y1eRb670NhzK/dO4SZyzo+McgZ9yMRiY8qh+tNAKrNdz7a9bgQE5t6Ufaqi9N1DX+Xy7voFJrirfHuOXq3XrBuytLirJ+kdY2ETkDJrZRM073m6JJjNyGRub/bhNin6wwraesvGdv3+xUifiDeltyPCNa7eDPxbeC/LwQ0WEMynm42cB55tbL/QnDRZdrC7tv7RpJv1Ojr57FYKNWC95gd2kAVbJC7KpkwnrlcknJGjaNC7+ecnDXB7aQ5C8v/qH0h6UkN79WUhfFqDNA5l/FhqaqqU3YIsQpwnTm9werD6k/Rw2Z023+4tgGK4iAteTbZD5SFlEuxhnOvyon6tREjm0MFPRKDcEgteOc8xT4bsNBQU9cCpawsO8aUQw22i34FRPWqw5tR6J3ewtQnrMB28DMhEgn+yh/7tbJOCgRymC3cOs+fgTydXZk3mp6DYGsuKSk196K2wTFj+TRlQUXscGBNMGY6OQW8ho5B9y X-Forefront-PRVS: 0136C1DDA4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(189002)(39380400001)(39410400001)(36756003)(4326007)(33646002)(81156014)(7736002)(50226002)(81166006)(5660300001)(305945005)(2906002)(7846002)(110136003)(8676002)(66066001)(2950100002)(6916009)(6666003)(50466002)(47776003)(48376002)(3846002)(2351001)(97736004)(92566002)(6116002)(189998001)(77096005)(86362001)(106356001)(5003940100001)(38730400001)(105586002)(68736007)(76176999)(50986999)(42186005)(101416001)(39400400001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0401MB1778; H:b54642-OptiPlex-3020.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR0401MB1778; 23:B0b7OoM89r4vQLEWOYtlec3vk49SyHIU5KriDxS?= =?us-ascii?Q?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= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB1778; 7:XxX2BPTb+q09tHdunWjH8SrYTzWXxC9gHScGhaUaCZDvZhFRXm9TmuANiAz9w8MK3/Y5XxE747GbRtpPXDWB3HG7QoacbDAL9Tvc32gi2x7tqKEu7m0uup+Yd0fcbEDUHr9237QelZgUXeCACi9TpwSNwnV8SYNFNYyqiNyd0mPMRV7eX3OqqHDiI8giCqMU3x1Hw3nL0wwu+PL+9bJu4Qx3TQX1+1JQ9hLbH2cnaUpHjTkki4+lyKlqXXbM6uUtL9x/GhLGtFW27Gjd0mOn4zBPkFrQTvrvrLmlStjZwWmaZ5ZE/QEZzGQTFf/17wBeExfW0PsJC4d/efhRQfijiW7I+4X/eKvpeDFLX0A3rAo0izPCOe2d0GlxiM1M2+tRdVlTNKQX/gfqClEPNw8oV1qmn5kz955P1vCYiRylUMt9GsaZVZ4HzjkR9xwJJ9Dkb1KUDqgeFcqLSaxayITLVg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2016 11:06:02.6997 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0401MB1778 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a static checker warning in fsl_lpspi_set_cmd(). I intended to write "temp |= (fsl_lpspi->config.mode & 0x3) << 30", but used "temp |= (fsl_lpspi->config.mode & 0x11) << 30" by mistake. This patch fixes this potential shift truncation. Signed-off-by: Gao Pan --- drivers/spi/spi-fsl-lpspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index 901bef4..bc4a605 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -217,7 +217,7 @@ static void fsl_lpspi_set_cmd(struct fsl_lpspi_data *fsl_lpspi, temp |= fsl_lpspi->config.bpw - 1; temp |= fsl_lpspi->config.prescale << 27; - temp |= (fsl_lpspi->config.mode & 0x11) << 30; + temp |= (fsl_lpspi->config.mode & 0x3) << 30; temp |= (fsl_lpspi->config.chip_select & 0x3) << 24; /*