Re: [PATCH v2] pstore: Convert internal records to timespec64

From: Arnd Bergmann
Date: Wed May 30 2018 - 11:06:48 EST


On Tue, May 15, 2018 at 12:50 AM, Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index 49b2bc114868..69e893076ab7 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -38,6 +38,11 @@
>
> #define RAMOOPS_KERNMSG_HDR "===="
> #define MIN_MEM_SIZE 4096UL
> +#if __BITS_PER_LONG == 64
> +# define TVSEC_FMT "%ld"
> +#else
> +# define TVSEC_FMT "%lld"
> +#endif
>
> static ulong record_size = MIN_MEM_SIZE;
> module_param(record_size, ulong, 0400);

Unfortunately, this bit conflicts with my patch "timekeeping: Remove
timespec64 hack"
that Thomas queued in tip: https://lkml.org/lkml/2018/5/19/115, causing
a harmless but annoying build warning on 64-bit machines:

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'

The tip/timers/y2038 branch is currently not part of linux-next. It should be
easy to fix it up with a patch on top that open-codes TVSEC_FMT as %lld,
and adds a cast to 'long long' like every other such printk has at the moment
(allowing them the casts to be mass-removed after my patch is merged).

Arnd