All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ksenija Stanojević" <ksenija.stanojevic@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: y2038@lists.linaro.org,
	 outreachy-kernel <outreachy-kernel@googlegroups.com>
Subject: Re: [Y2038] [PATCH 3/5] fs: nfsd: Replace time_t with u32 in nfsd4_grace
Date: Tue, 3 Nov 2015 18:27:53 -0800	[thread overview]
Message-ID: <CAL7P5jJUV_0zRNQwBviCZMPDNtZuHONGL3WU+VX6fvk9MsYifA@mail.gmail.com> (raw)
In-Reply-To: <5919340.GhJnFQNPk1@wuerfel>

On Tue, Nov 3, 2015 at 4:17 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 27 October 2015 09:10:45 Ksenija Stanojevic wrote:
>> Replace time_t type and get_seconds function which are not y2038 safe on
>> 32-bit systems. Function ktime_get_seconds use monotonic instead of real
>> time and therefore will not cause overflow.
>>
>> Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
>
> I think this patch needs to be folded into the patch that changes the
> type for nfsd4_lease, as mentioned there.
>
>>       locks_start_grace(net, &nn->nfsd4_manager);
>>       nfsd4_client_tracking_init(net);
>> -     printk(KERN_INFO "NFSD: starting %ld-second grace period (net %p)\n",
>> +     printk(KERN_INFO "NFSD: starting %x-second grace period (net %p)\n",
>>              nn->nfsd4_grace, net);
>>       queue_delayed_work(laundry_wq, &nn->laundromat_work, nn->nfsd4_grace * HZ);
>
>>
>> -     return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n", *time);
>> +     return scnprintf(buf, (u32)SIMPLE_TRANSACTION_LIMIT, "%x\n", *time);
>>  }
>>
>>  static ssize_t nfsd4_write_time(struct file *file, char *buf, size_t size,
>>
>
> You change the format string to print the time as hexadecimal. Is that
> intentional? If there is a reason for doing it, explain it in the changelog,
> otherwise leave it as "%d".
>
> The cast of SIMPLE_TRANSACTION_LIMIT to u32 looks misplaced as well.

I got following warnings with original code and I was trying to fix them:
include/linux/fs.h:2908:61: warning: format ‘%ld’ expects argument of
type ‘long int’, but argument 4 has type ‘u32’ [-Wformat=]
 #define SIMPLE_TRANSACTION_LIMIT (PAGE_SIZE - sizeof(struct
simple_transaction_argresp))
                                                             ^
fs/nfsd/nfsctl.c:963:24: note: in expansion of macro ‘SIMPLE_TRANSACTION_LIMIT’
  return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n", *time);

but I see now that changing %ld to %d works as well.

Thanks,
Ksenija


  reply	other threads:[~2015-11-04  2:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-27 16:07 [PATCH 0/5] fs: nfsd: Remove time_t Ksenija Stanojevic
2015-10-27 16:08 ` [PATCH 1/5] fs: nfsd: Replace time_t with u32 in boot_time Ksenija Stanojevic
2015-11-04  0:04   ` [Y2038] " Arnd Bergmann
2015-11-04  2:17     ` Ksenija Stanojević
2015-11-04 14:44       ` [Outreachy kernel] " Arnd Bergmann
2015-10-27 16:09 ` [PATCH 2/5] fs: nfsd: Replace time_t with u32 in nfsd4_lease Ksenija Stanojevic
2015-11-04  0:14   ` [Y2038] " Arnd Bergmann
2015-11-10  4:37     ` Ksenija Stanojević
2015-11-10 10:01       ` Arnd Bergmann
2015-10-27 16:10 ` [PATCH 3/5] fs: nfsd: Replace time_t with u32 in nfsd4_grace Ksenija Stanojevic
2015-11-04  0:17   ` [Y2038] " Arnd Bergmann
2015-11-04  2:27     ` Ksenija Stanojević [this message]
2015-11-04 13:57       ` Arnd Bergmann
2015-10-27 16:11 ` [PATCH 4/5] fs: nfsd: Replace time_t with u32 dl_time Ksenija Stanojevic
2015-11-04  0:20   ` [Y2038] " Arnd Bergmann
2015-10-27 16:12 ` [PATCH 5/5] fs: nfsd: Replace time_t with u32 oo_time Ksenija Stanojevic
2015-11-04  0:21   ` [Y2038] " Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAL7P5jJUV_0zRNQwBviCZMPDNtZuHONGL3WU+VX6fvk9MsYifA@mail.gmail.com \
    --to=ksenija.stanojevic@gmail.com \
    --cc=arnd@arndb.de \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.