Add SNDRV_TIMER_IOCTL_STATUS in compat_ioctl functions for the compat
application which want to migrate to year 2038 safe.
In the other hand, convert the time stamp between 64bit in kernel and
32bit in userspace for the old SNDRV_TIMER_IOCTL_STATUS32.

Signed-off-by: Bamvor Zhang Jian <[email protected]>
---
 sound/core/timer_compat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/core/timer_compat.c b/sound/core/timer_compat.c
index e05802a..36f5989 100644
--- a/sound/core/timer_compat.c
+++ b/sound/core/timer_compat.c
@@ -76,7 +76,8 @@ static int snd_timer_user_status_compat(struct file *file,
        if (snd_BUG_ON(!tu->timeri))
                return -ENXIO;
        memset(&status, 0, sizeof(status));
-       status.tstamp = tu->tstamp;
+       status.tstamp.tv_sec = (compat_time_t)(tu->tstamp.tv_sec & 0xffffffff);
+       status.tstamp.tv_nsec = (s32)(tu->tstamp.tv_nsec & 0xffffffff);
        status.resolution = snd_timer_resolution(tu->timeri);
        status.lost = tu->timeri->lost;
        status.overrun = tu->overrun;
@@ -117,6 +118,7 @@ static long snd_timer_user_ioctl_compat(struct file *file, 
unsigned int cmd, uns
        case SNDRV_TIMER_IOCTL_PAUSE:
        case SNDRV_TIMER_IOCTL_PAUSE_OLD:
        case SNDRV_TIMER_IOCTL_NEXT_DEVICE:
+       case SNDRV_TIMER_IOCTL_STATUS:
                return snd_timer_user_ioctl(file, cmd, (unsigned long)argp);
        case SNDRV_TIMER_IOCTL_INFO32:
                return snd_timer_user_info_compat(file, argp);
-- 
2.1.4

_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038

Reply via email to