Re: [PATCH] x86/alternatives: Fix alt_max_short macro to really be a max()

2017-10-05 Thread Borislav Petkov
On Thu, Oct 05, 2017 at 02:35:33PM +0200, Mathias Krause wrote: > Oh, btw., quoting its counter part from > arch/x86/include/asm/alternative-asm.h: > > /* > * max without conditionals. Idea adapted from: > * http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax > */ > #define alt

Re: [PATCH] x86/alternatives: Fix alt_max_short macro to really be a max()

2017-10-05 Thread Mathias Krause
On 5 October 2017 at 14:52, Michael Matz wrote: > On Thu, 5 Oct 2017, Borislav Petkov wrote: >> On Thu, Oct 05, 2017 at 02:35:33PM +0200, Mathias Krause wrote: >> > Note the "<"! ...comment is wrong, though the implementation works! >> >> I know, I realized that when I looked at alternative-asm.h.

Re: [PATCH] x86/alternatives: Fix alt_max_short macro to really be a max()

2017-10-05 Thread Michael Matz
Hi, On Thu, 5 Oct 2017, Borislav Petkov wrote: > On Thu, Oct 05, 2017 at 02:35:33PM +0200, Mathias Krause wrote: > > Note the "<"! ...comment is wrong, though the implementation works! > > I know, I realized that when I looked at alternative-asm.h. Wanted to > double-check it with Micha first.

Re: [PATCH] x86/alternatives: Fix alt_max_short macro to really be a max()

2017-10-05 Thread Borislav Petkov
On Thu, Oct 05, 2017 at 02:35:33PM +0200, Mathias Krause wrote: > Note the "<"! ...comment is wrong, though the implementation works! I know, I realized that when I looked at alternative-asm.h. Wanted to double-check it with Micha first. Testing your patch now... -- Regards/Gruss, Boris. G

Re: [PATCH] x86/alternatives: Fix alt_max_short macro to really be a max()

2017-10-05 Thread Mathias Krause
On 5 October 2017 at 09:58, Mathias Krause wrote: > On 5 October 2017 at 09:38, Borislav Petkov wrote: >> On Wed, Oct 04, 2017 at 08:08:12PM +0200, Mathias Krause wrote: >>> diff --git a/arch/x86/include/asm/alternative.h >>> b/arch/x86/include/asm/alternative.h >>> index c096624137ae..7c553f48f

Re: [PATCH] x86/alternatives: Fix alt_max_short macro to really be a max()

2017-10-05 Thread Mathias Krause
On 5 October 2017 at 09:38, Borislav Petkov wrote: > On Wed, Oct 04, 2017 at 08:08:12PM +0200, Mathias Krause wrote: >> The alt_max_short() macro in asm/alternative.h does not work as >> intended, leading to nasty bugs. E.g. alt_max_short("1", "3") >> evaluates to 3, but alt_max_short("3", "1") ev

Re: [PATCH] x86/alternatives: Fix alt_max_short macro to really be a max()

2017-10-05 Thread Borislav Petkov
On Wed, Oct 04, 2017 at 08:08:12PM +0200, Mathias Krause wrote: > The alt_max_short() macro in asm/alternative.h does not work as > intended, leading to nasty bugs. E.g. alt_max_short("1", "3") > evaluates to 3, but alt_max_short("3", "1") evaluates to 1 -- not > exactly the maximum of 1 and 3. >