From patchwork Fri Feb 15 22:03:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 10815927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95A4413B5 for ; Fri, 15 Feb 2019 22:03:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 801BD302C0 for ; Fri, 15 Feb 2019 22:03:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E40F302CA; Fri, 15 Feb 2019 22:03:19 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 469DC302C0 for ; Fri, 15 Feb 2019 22:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387452AbfBOWDS (ORCPT ); Fri, 15 Feb 2019 17:03:18 -0500 Received: from mail-eopbgr730116.outbound.protection.outlook.com ([40.107.73.116]:10846 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728589AbfBOWDR (ORCPT ); Fri, 15 Feb 2019 17:03:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wavesemi.onmicrosoft.com; s=selector1-wavecomp-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=j57nb27h3MXJjEtEjh52GYMWXaxL3q8BwqW8Xz8yoBI=; b=IsgOY2YqLpXkjJT26fIUZ+rcbB2/HT3bbCuBotWUCAJ5nkgINDDwQWgxwV6hQGdKGoMpQPw4qFa9Lmc8Qm6pGCfcSnkTLV6FU432Rf+FUvZ7dcYvA9n8ua1wWfCSgYFXKFRjRui+XbhaoGBIBAuECkuslVLdpfdLIrCyltuVP50= Received: from MWHPR2201MB1277.namprd22.prod.outlook.com (10.174.162.17) by MWHPR2201MB1534.namprd22.prod.outlook.com (10.174.170.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.19; Fri, 15 Feb 2019 22:03:04 +0000 Received: from MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::7d5e:f3b0:4a5:4636]) by MWHPR2201MB1277.namprd22.prod.outlook.com ([fe80::7d5e:f3b0:4a5:4636%9]) with mapi id 15.20.1601.023; Fri, 15 Feb 2019 22:03:04 +0000 From: Paul Burton To: "linux-mips@vger.kernel.org" CC: Christoph Hellwig , Marek Szyprowski , Robin Murphy , Paul Burton Subject: [PATCH] MIPS: dma-noncoherent: Remove bogus condition in dma_sync_phys() Thread-Topic: [PATCH] MIPS: dma-noncoherent: Remove bogus condition in dma_sync_phys() Thread-Index: AQHUxXo5rh7pYxECVUC/VRrgIWfN0Q== Date: Fri, 15 Feb 2019 22:03:04 +0000 Message-ID: <20190215220250.30883-1-paul.burton@mips.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR05CA0090.namprd05.prod.outlook.com (2603:10b6:a03:e0::31) To MWHPR2201MB1277.namprd22.prod.outlook.com (2603:10b6:301:24::17) authentication-results: spf=none (sender IP is ) smtp.mailfrom=pburton@wavecomp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [67.207.99.198] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9f6d6ce6-9e85-40e4-45a9-08d693915b92 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020);SRVR:MWHPR2201MB1534; x-ms-traffictypediagnostic: MWHPR2201MB1534: x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BMWHPR2201MB1534=3B23=3A?= =?iso-8859-1?q?vGsguZI5Hh2aN1/mGKGacIn/GOQ7eHh+OA9Q4zEc/bKuw4VvYWe3dBC/Sz9A?= =?iso-8859-1?q?sfbQktrZ0iAvWsXDpCWmVxVke/FGsE56D9OxLZqqMQd+nYMmwWjCSXh58TTT?= =?iso-8859-1?q?YSYG9SlHpSi8Jhvzlh2oCQd3KDW0mbc5EKVNcDH2atZyrTTBCMO8jwMqysEm?= =?iso-8859-1?q?PAtEQeHesfhxnJJMpwnG0qGWVcLYUoqN/N1UL9QH5f4FVGLkM5SF+r5YhPFB?= =?iso-8859-1?q?H0YhcrMnVZMUea5vfYMP96fTJtDsn5MOLyEVmGm/d58jX2/WzQh6oI+EwzTD?= =?iso-8859-1?q?mP1E/430kla6D3AGMP3Uy6JK1rIqc0HEKh8b/AB8YkualmAozbLqZjMceumd?= =?iso-8859-1?q?qMRXjTCIEMkZOhnpEY/U6hY+c8EPmqyBZNYKdU8LDvrVwWLkj7MLLNKlPL0b?= =?iso-8859-1?q?0ELJ12alS14Hu2Suhqts5xukHF4TiSQva78i88mjXTdk+PNgYj/EQ0+r7hIa?= =?iso-8859-1?q?eBUACItld48N6RFpcapOB0fLp8CX9O2B84E5zuKxQtBGDW9E/S76E1J6Gp4Z?= =?iso-8859-1?q?OiAPx+nI/NqIPWSprsCd4TiQHnWcwrNoSKe1oXPowwPNbAU4IfaVsfN8pY6+?= =?iso-8859-1?q?chFIJRi8zCzUlVyJxvgnFp3mQjp4yEAE1g/XihhDkEH1wcDNRXi8gFNKg9X9?= =?iso-8859-1?q?+uekfphoBasx5+sR/qdnuEQGmP65mXYI2Q0Y+ZykayqtInXUwZPF2p0M1eno?= =?iso-8859-1?q?nKUVpM9wnDHi56CVpug1BJUGPhE/+a8LtucE6jJrr1DcVBXAUcO28a4ls+nW?= =?iso-8859-1?q?6nJYk9oisV//rHoePIA2KUqrtHJixXTTd2ZKy/IbwEilRa/V/1Y2FQT+hq4Q?= =?iso-8859-1?q?4JN+d9yahgOHcZ9MzWjqUXZehGa8r+peONIBg4FL/4srmfVHu7yov8d/QnWe?= =?iso-8859-1?q?Dbmlk7FjR/n+M7Yud0ALzVeDxIHY6U0xSp6PDR/PEEqkat53oXo2qDamTPhX?= =?iso-8859-1?q?vmyuZJYAMqQfuUiHzVLnaYc1yBNtVOnQvP9ANtwYbWqNL2h0H+0N8XiQNOHg?= =?iso-8859-1?q?bgKJVW7zCoyDbx3h8gr8qjK3bPwLmq7TI/IpZE/CzjXkEVjpt+vj5AOYNjQh?= =?iso-8859-1?q?KdWYbDV/FqlEFgNq8FJGkteDAuDhDVFGHCSpME66VqxKyTJhh+Y07wO4Mmda?= =?iso-8859-1?q?F3pOfhUjBuzfBwZY3+23A+3N9aKguN9eG9pMDa4Jb0XyBERs0+2vQ2dZCblB?= =?iso-8859-1?q?gD7OJ9o4wBH3vDtkayjJe+qEmfcuLUrRDA40mOTIGmnJ4lDNUECsgtq4qr8F?= =?iso-8859-1?q?Dfb+6d3onJU8dndugTQJ?= x-microsoft-antispam-prvs: x-forefront-prvs: 09497C15EB x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(39840400004)(396003)(136003)(376002)(346002)(189003)(199004)(68736007)(42882007)(2906002)(1076003)(99286004)(102836004)(186003)(478600001)(2501003)(54906003)(52116002)(486006)(50226002)(6506007)(6486002)(6116002)(3846002)(316002)(107886003)(26005)(53936002)(386003)(66066001)(5660300002)(5640700003)(6512007)(4326008)(8676002)(71200400001)(36756003)(8936002)(81156014)(2616005)(44832011)(476003)(71190400001)(6916009)(81166006)(6436002)(25786009)(14454004)(106356001)(97736004)(256004)(14444005)(105586002)(2351001)(7736002)(305945005);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR2201MB1534;H:MWHPR2201MB1277.namprd22.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: wavecomp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: rmnt+qyiXpw2dmh/mNKaTFNDcxAQJns4sXprVfGFdcdJmvZnavriidRwFexd+b9WGXTBLTjjcPeI2dXEF4RX7njpHbpvPi9JUhmIm5a3WzSy9+E+GdDcS2HgypQKZaJM0hYH1vAH9ij4oQJgYTCpEX4RdihIjFpSrNPO7A+oMqfQJK2hW5rBEh8G5H4V1L2bkvrNLC8JbToVdHnPXgPXfzlMOvg1UrMzUnjAZr/KTNyyz3Ke8YzLDcvo436dxz8pp20IqHrXUgn0/U+rHP3Zt0gPkYwsqRTu+8f+7r2AkSuhA1WtjOo4YmArvJW55MfENPFzLXplIpzopNf0RO5FjmNe3PAiSOaip/tF1oydbcDadYiCLNvj0fICgCwfcCUxvUJDaPPCLheyZHA97IxzSwwPKTGhUyrmz7HLX5dgiFw= MIME-Version: 1.0 X-OriginatorOrg: mips.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f6d6ce6-9e85-40e4-45a9-08d693915b92 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Feb 2019 22:03:03.3546 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 463607d3-1db3-40a0-8a29-970c56230104 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR2201MB1534 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit e36863a550da ("MIPS: HIGHMEM DMA on noncoherent MIPS32 processors") introduced code which: 1) Calculates an offset within a page, by ANDing an address with ~PAGE_MASK. 2) Checks whether that offset is >= PAGE_SIZE. This check can never evaluate true, making the code it guards unreachable. smatch spots bogus arithmetic resulting from the impossible condition, resulting in the following warning: arch/mips/mm/dma-noncoherent.c:125 dma_sync_phys() warn: mask and shift to zero Fix this by removing the impossible to satisfy condition & the unreachable code it guards. Signed-off-by: Paul Burton --- arch/mips/mm/dma-noncoherent.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/mips/mm/dma-noncoherent.c b/arch/mips/mm/dma-noncoherent.c index f7e0fd6b7619..b57465733e87 100644 --- a/arch/mips/mm/dma-noncoherent.c +++ b/arch/mips/mm/dma-noncoherent.c @@ -120,13 +120,8 @@ static inline void dma_sync_phys(phys_addr_t paddr, size_t size, if (PageHighMem(page)) { void *addr; - if (offset + len > PAGE_SIZE) { - if (offset >= PAGE_SIZE) { - page += offset >> PAGE_SHIFT; - offset &= ~PAGE_MASK; - } + if (offset + len > PAGE_SIZE) len = PAGE_SIZE - offset; - } addr = kmap_atomic(page); dma_sync_virt(addr + offset, len, dir);