Re: [PATCH v2 4/6] ipc: sem: Make sem_array timestamps y2038 safe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 31, 2017 at 12:30 AM, Deepa Dinamani <deepa.kernel@xxxxxxxxx> wrote:
> time_t is not y2038 safe. Replace all uses of
> time_t by y2038 safe time64_t.
>
> Similarly, replace the calls to get_seconds() with
> y2038 safe ktime_get_real_seconds().
> Note that this preserves fast access on 64 bit systems,
> but 32 bit systems need sequence counters.
>
> The syscall interface themselves are not changed as part of
> the patch. They will be part of a different series.
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@xxxxxxxxx>

Looks good. One detail:

> @@ -2310,7 +2310,7 @@ static int sysvipc_sem_proc_show(struct seq_file *s, void *it)
>         sem_otime = get_semotime(sma);
>
>         seq_printf(s,
> -                  "%10d %10d  %4o %10u %5u %5u %5u %5u %10lu %10lu\n",
> +                  "%10d %10d  %4o %10u %5u %5u %5u %5u %10llu %10llu\n",
>                    sma->sem_perm.key,
>                    sma->sem_perm.id,
>                    sma->sem_perm.mode,
> @@ -2319,8 +2319,8 @@ static int sysvipc_sem_proc_show(struct seq_file *s, void *it)
>                    from_kgid_munged(user_ns, sma->sem_perm.gid),
>                    from_kuid_munged(user_ns, sma->sem_perm.cuid),
>                    from_kgid_munged(user_ns, sma->sem_perm.cgid),
> -                  sem_otime,
> -                  sma->sem_ctime);
> +                  (unsigned long long) sem_otime,
> +                  (unsigned long long) sma->sem_ctime);
>

Unless I'm missing something here, you can drop the cast to
unsigned long long: time64_t is always 'long long' and won't
cause a warning here.

We only need a cast like this when printing the members of 'struct
 timespec64', since that can be either 'long long' or 'long', when
it is defined as an alias for timespec.

        Arnd



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux