Messages in this thread | | | From | Mathias Krause <> | Date | Thu, 5 Oct 2017 14:35:33 +0200 | Subject | Re: [PATCH] x86/alternatives: Fix alt_max_short macro to really be a max() |
| |
On 5 October 2017 at 09:58, Mathias Krause <minipli@googlemail.com> wrote: > On 5 October 2017 at 09:38, Borislav Petkov <bp@alien8.de> 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..7c553f48f163 100644 >>> --- a/arch/x86/include/asm/alternative.h >>> +++ b/arch/x86/include/asm/alternative.h >>> @@ -106,9 +106,9 @@ static inline int alternatives_text_reserved(void *start, void *end) >>> * max without conditionals. Idea adapted from: >> ^^^^^^^^^^^^^^^^^^^^^^^^^ >> >> You did read this part, right?
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_max_short(a, b) ((a) ^ (((a) ^ (b)) & -(-((a) < (b)))))
Note the "<"! ...comment is wrong, though the implementation works!
Cheers, Mathias
| |