lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 3 Mar 2018 08:45:51 +0100
From:   christophe leroy <christophe.leroy@....fr>
To:     Mathieu Malaterre <malat@...ian.org>,
        Segher Boessenkool <segher@...nel.crashing.org>
Cc:     Michael Ellerman <mpe@...erman.id.au>,
        linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
        Paul Mackerras <paulus@...ba.org>,
        LKML <linux-kernel@...r.kernel.org>, Jiri Slaby <jslaby@...e.com>
Subject: Re: [PATCH 05/21] powerpc: Avoid comparison of unsigned long >= 0 in
 pfn_valid



Le 02/03/2018 à 20:54, Mathieu Malaterre a écrit :
> On Mon, Feb 26, 2018 at 9:46 AM, Segher Boessenkool
> <segher@...nel.crashing.org> 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 <christophe.leroy@....fr>

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ