This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/9] y2038: asm-generic: extend sysvipc data structures
- From: Arnd Bergmann <arnd at arndb dot de>
- To: Geert Uytterhoeven <geert at linux-m68k dot org>
- Cc: y2038 at lists dot linaro dot org, baolin dot wang at linaro dot org, albert dot aribaud at 3adev dot fr, John Stultz <john dot stultz at linaro dot org>, bamvor dot zhangjian at linaro dot org, ruchandani dot tina at gmail dot com, "linux-api at vger dot kernel dot org" <linux-api at vger dot kernel dot org>, "linux-kernel at vger dot kernel dot org" <linux-kernel at vger dot kernel dot org>, libc-alpha at sourceware dot org, Linux-Arch <linux-arch at vger dot kernel dot org>, Manfred Spraul <manfred at colorfullife dot com>, Michael Kerrisk <mtk dot manpages at gmail dot com>
- Date: Thu, 21 May 2015 16:52:31 +0200
- Subject: Re: [PATCH 2/9] y2038: asm-generic: extend sysvipc data structures
- Authentication-results: sourceware.org; auth=none
- References: <1432134445-804487-1-git-send-email-arnd at arndb dot de> <1432134445-804487-3-git-send-email-arnd at arndb dot de> <CAMuHMdUtJ2x+axBLj5qdsRwod=XdRkmeYJm1N7H5V_CXLo5J0g at mail dot gmail dot com>
On Thursday 21 May 2015 10:56:34 Geert Uytterhoeven wrote:
> > + * value using
> > + *
> > + * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime +
> > + * (long long)(kernel_semid64_ds.sem_otime_high << 32)
>
> The cast to "long long" should be inside the parentheses, to promote the
> (32-bit) sem_otime_high to a first 64-bit integer first.
> Else it will be shifted into oblivion (oh no, C undefined behavior).
>
>
Fixed now to say
* user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime +
* ((long long)kernel_semid64_ds.sem_otime_high << 32)
Thanks!
Arnd