• Ingo Molnar's avatar
    x86/fpu: Change 'size_total' parameter to unsigned and standardize the size... · 6ff15f8d
    Ingo Molnar authored
    x86/fpu: Change 'size_total' parameter to unsigned and standardize the size checks in copy_xstate_to_*()
    
    'size_total' is derived from an unsigned input parameter - and then converted
    to 'int' and checked for negative ranges:
    
    	if (size_total < 0 || offset < size_total) {
    
    This conversion and the checks are unnecessary obfuscation, reject overly
    large requested copy sizes outright and simplify the underlying code.
    Reported-by: default avatarRik van Riel <riel@redhat.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: Eric Biggers <ebiggers3@gmail.com>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Yu-cheng Yu <yu-cheng.yu@intel.com>
    Link: http://lkml.kernel.org/r/20170923130016.21448-10-mingo@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    6ff15f8d
xstate.c 30.4 KB