Received: by 10.223.185.116 with SMTP id b49csp451091wrg; Fri, 2 Mar 2018 23:46:54 -0800 (PST) X-Google-Smtp-Source: AG47ELuROompwDykydyuOchi6LBO/JJ7ARbfiKIsvlgvQD8jsge3j6hSFjrgPvxT4OEqpiD+BVht X-Received: by 10.99.95.201 with SMTP id t192mr6741176pgb.313.1520063214444; Fri, 02 Mar 2018 23:46:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520063214; cv=none; d=google.com; s=arc-20160816; b=eUxVi3or25rooA0BQz0M6NYpho7wrHyYT//rr4jLC5B0+PgrXNlTE8Tl/IY7wrRIWz sQZ3dLsY62SEql2MBJSqjCDSgdbWymgyfH//dFmrIC7BCJnEFJpkXda2FgczUflJVh3a fgZzhIpNSDmJWlGTbtrpWw8FuZKnqNOjxwmMUXWAMh0QLcrkmLzhGwp1n9dQK8QwIGVD nq9iTh+Qdgfj8mCFdAlyhBvY/u9jSntkpJccBw6weY4cxn9aL5Vy1PAgIB3gop0KBcwO 8uaOwZqKJh0DKpHUqJCSpSkNqYg/xvgox2spdap4Le19vZrW7XW31Za3X0g5+bqMnk4X Cyig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=UmmR4+a/EXL9ld5YWs7vd4NEMqmEvfGy0qspZbFFglQ=; b=DevAp5LfeUCYFMiVTx9I4JbShllDeXaiVcMD7v+J6wN7lQrHGbtj/gvFzdT40UMgqK SShLC9IOAtLz/78wN1VpFq9+XKwaobTL7or435SjoYAQIq6Zcl8t69jKgHZ2hk0W7GOj E5PV9FrZmoWtVif4n6BAUGIQOtEmRiSUnhB4pQJKzrOWt2yq1VrFNs8pVd6WF1I0W56T lj2Afz03qBXx9kUdqoo38VcWq2koF6OMd/Ht3Pj46F+K/G6OI1VJ8knVd9B0xXBLNihR z4FIqAZLbZD5LpKWfMeWn40343vToVCEApu9Vd4Dhjd31HTnEYhhhtK7TaasjUWfZc/t 1tGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r19si6313777pfi.100.2018.03.02.23.46.39; Fri, 02 Mar 2018 23:46:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751825AbeCCHqC (ORCPT + 99 others); Sat, 3 Mar 2018 02:46:02 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:64444 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751331AbeCCHqB (ORCPT ); Sat, 3 Mar 2018 02:46:01 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 3ztdWq6MlGz9txcy; Sat, 3 Mar 2018 08:45:59 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id DxwgSQL-YrNW; Sat, 3 Mar 2018 08:45:59 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 3ztdWq5jy6z9txc4; Sat, 3 Mar 2018 08:45:59 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 367548B89E; Sat, 3 Mar 2018 08:46:00 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id IYBKEsD_HFTg; Sat, 3 Mar 2018 08:46:00 +0100 (CET) Received: from [192.168.232.53] (unknown [192.168.232.53]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CB63D8B897; Sat, 3 Mar 2018 08:45:59 +0100 (CET) Subject: Re: [PATCH 05/21] powerpc: Avoid comparison of unsigned long >= 0 in pfn_valid To: Mathieu Malaterre , Segher Boessenkool Cc: Michael Ellerman , linuxppc-dev , Paul Mackerras , LKML , Jiri Slaby References: <20180225172236.29650-1-malat@debian.org> <20180225172236.29650-6-malat@debian.org> <55d52f37-c24d-c2da-43c6-73a55403d3b6@c-s.fr> <20180226084602.GR21977@gate.crashing.org> From: christophe leroy Message-ID: <298c9ecc-831b-4d70-b86c-f586a319a133@c-s.fr> Date: Sat, 3 Mar 2018 08:45:51 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit X-Antivirus: Avast (VPS 180302-4, 02/03/2018), Outbound message X-Antivirus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 02/03/2018 à 20:54, Mathieu Malaterre a écrit : > On Mon, Feb 26, 2018 at 9:46 AM, Segher Boessenkool > wrote: >> On Mon, Feb 26, 2018 at 07:32:03AM +0100, Christophe LEROY wrote: >>> Le 25/02/2018 à 18:22, Mathieu Malaterre a écrit : >>>> -#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < >>>> max_mapnr) >>>> +#define pfn_valid(pfn) \ >>>> + (((pfn) - ARCH_PFN_OFFSET) < (max_mapnr - ARCH_PFN_OFFSET)) >>> >>> What will happen when ARCH_PFN_OFFSET is not nul and pfn is lower than >>> ARCH_PFN_OFFSET ? >> >> It will work fine. >> >> Say you are asking for a <= x < b so (in actual integers, no overflow) >> that is 0 <= x-a < b-a and you also assume x-a overflows, so that we >> are actually comparing x-a+M < b-a with M = 2**32 or such (the maximum >> value in the unsigned integer type plus one). This comparison is >> obviously always false. >> >> (It also works if b < a btw). >> >> > Thanks Segher ! > > Christophe does that clarify things or do you want me to update the > commit message ? > No it is fine for me. Reviewed-by: Christophe Leroy --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus