• Arnd Bergmann's avatar
    pstore: Remove bogus format string definition · e264abea
    Arnd Bergmann authored
    The pstore conversion to timespec64 introduces its own method of passing
    seconds into sscanf() and sprintf() type functions to work around the
    timespec64 definition on 64-bit systems that redefine it to 'timespec'.
    
    That hack is now finally getting removed, but that means we get a (harmless)
    warning once both patches are merged:
    
    fs/pstore/ram.c: In function 'ramoops_read_kmsg_hdr':
    fs/pstore/ram.c:39:29: error: format '%ld' expects argument of type 'long int *', but argument 3 has type 'time64_t *' {aka 'long long int *'} [-Werror=format=]
     #define RAMOOPS_KERNMSG_HDR "===="
                                 ^~~~~~
    fs/pstore/ram.c:167:21: note: in expansion of macro 'RAMOOPS_KERNMSG_HDR'
    
    This removes the pstore specific workaround and uses the same method that
    we have in place for all other functions that print a timespec64.
    
    Related to this, I found that the kasprintf() output contains an incorrect
    nanosecond values for any number starting with zeroes, and I adapt the
    format string accordingly.
    
    Link: https://lkml.org/lkml/2018/5/19/115
    Link: https://lkml.org/lkml/2018/5/16/1080
    Fixes: 0f0d83b99ef7 ("pstore: Convert internal records to timespec64")
    Acked-by: default avatarKees Cook <keescook@chromium.org>
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    e264abea
ram.c 24.2 KB