• Chao Fan's avatar
    x86/boot: Copy kstrtoull() to boot/string.c · de50ce20
    Chao Fan authored
    Copy kstrtoull() and the other necessary functions from lib/kstrtox.c
    to boot/string.c so that code in boot/ can use kstrtoull() and the old
    simple_strtoull() can gradually be phased out.
    
    Using div_u64() from math64.h directly will cause the dividend to be
    handled as a 64-bit value and cause the infamous __divdi3 linker error
    due to gcc trying to use its library function for the 64-bit division.
    
    Therefore, separate the dividend into an upper and lower part.
    
     [ bp: Rewrite commit message. ]
    Signed-off-by: default avatarChao Fan <fanc.fnst@cn.fujitsu.com>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Cc: bhe@redhat.com
    Cc: caoj.fnst@cn.fujitsu.com
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: indou.takao@jp.fujitsu.com
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: kasong@redhat.com
    Cc: Kees Cook <keescook@chromium.org>
    Cc: msys.mizuma@gmail.com
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: x86-ml <x86@kernel.org>
    Link: https://lkml.kernel.org/r/20190123110850.12433-2-fanc.fnst@cn.fujitsu.com
    de50ce20
string.c 6.91 KB