diff mbox series

[RFC,6/7] uapi: sound: Avoid using timespec for struct snd_ctl_elem_value

Message ID f47f86aa2bc1b96fbe47737f795ea1aee642caa0.1505973912.git.baolin.wang@linaro.org
State Superseded
Headers show
Series Fix year 2038 issue for sound subsystem | expand

Commit Message

(Exiting) Baolin Wang Sept. 21, 2017, 6:18 a.m. UTC
The struct snd_ctl_elem_value will use 'timespec' type variables to record
timestamp, which is not year 2038 safe on 32bits system.

Since there are no drivers will implemented the tstamp member of the
struct snd_ctl_elem_value, and also the stucture size will not be changed
if we change timespec to s64 for tstamp member of struct snd_ctl_elem_value.

Thus we can simply change timespec to s64 for tstamp member to avoid
using the type which is not year 2038 safe on 32bits system.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

---
 include/uapi/sound/asound.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
1.7.9.5

Comments

Arnd Bergmann Sept. 21, 2017, 12:58 p.m. UTC | #1
On Thu, Sep 21, 2017 at 8:18 AM, Baolin Wang <baolin.wang@linaro.org> wrote:
> The struct snd_ctl_elem_value will use 'timespec' type variables to record

> timestamp, which is not year 2038 safe on 32bits system.

>

> Since there are no drivers will implemented the tstamp member of the

> struct snd_ctl_elem_value, and also the stucture size will not be changed

> if we change timespec to s64 for tstamp member of struct snd_ctl_elem_value.

>

> Thus we can simply change timespec to s64 for tstamp member to avoid

> using the type which is not year 2038 safe on 32bits system.

>

> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

> ---

>  include/uapi/sound/asound.h |    4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h

> index 1949923..71bce52 100644

> --- a/include/uapi/sound/asound.h

> +++ b/include/uapi/sound/asound.h

> @@ -943,8 +943,8 @@ struct snd_ctl_elem_value {

>                 } bytes;

>                 struct snd_aes_iec958 iec958;

>         } value;                /* RO */

> -       struct timespec tstamp;

> -       unsigned char reserved[128-sizeof(struct timespec)];

> +       struct { s64 tv_sec; s64 tv_nsec; } tstamp;

> +       unsigned char reserved[128-sizeof(struct { s64 tv_sec; s64 tv_nsec; })];

>  };


Maybe we should enforce that nobody uses the timespec field, by
enclosing it in #ifdef __KERNEL__ (with a matching length below it);

       Arnd
(Exiting) Baolin Wang Sept. 26, 2017, 9:54 p.m. UTC | #2
On 21 September 2017 at 20:58, Arnd Bergmann <arnd@arndb.de> wrote:
> On Thu, Sep 21, 2017 at 8:18 AM, Baolin Wang <baolin.wang@linaro.org> wrote:

>> The struct snd_ctl_elem_value will use 'timespec' type variables to record

>> timestamp, which is not year 2038 safe on 32bits system.

>>

>> Since there are no drivers will implemented the tstamp member of the

>> struct snd_ctl_elem_value, and also the stucture size will not be changed

>> if we change timespec to s64 for tstamp member of struct snd_ctl_elem_value.

>>

>> Thus we can simply change timespec to s64 for tstamp member to avoid

>> using the type which is not year 2038 safe on 32bits system.

>>

>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>

>> ---

>>  include/uapi/sound/asound.h |    4 ++--

>>  1 file changed, 2 insertions(+), 2 deletions(-)

>>

>> diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h

>> index 1949923..71bce52 100644

>> --- a/include/uapi/sound/asound.h

>> +++ b/include/uapi/sound/asound.h

>> @@ -943,8 +943,8 @@ struct snd_ctl_elem_value {

>>                 } bytes;

>>                 struct snd_aes_iec958 iec958;

>>         } value;                /* RO */

>> -       struct timespec tstamp;

>> -       unsigned char reserved[128-sizeof(struct timespec)];

>> +       struct { s64 tv_sec; s64 tv_nsec; } tstamp;

>> +       unsigned char reserved[128-sizeof(struct { s64 tv_sec; s64 tv_nsec; })];

>>  };

>

> Maybe we should enforce that nobody uses the timespec field, by

> enclosing it in #ifdef __KERNEL__ (with a matching length below it);


OK.

-- 
Baolin.wang
Best Regards
diff mbox series

Patch

diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 1949923..71bce52 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -943,8 +943,8 @@  struct snd_ctl_elem_value {
 		} bytes;
 		struct snd_aes_iec958 iec958;
 	} value;		/* RO */
-	struct timespec tstamp;
-	unsigned char reserved[128-sizeof(struct timespec)];
+	struct { s64 tv_sec; s64 tv_nsec; } tstamp;
+	unsigned char reserved[128-sizeof(struct { s64 tv_sec; s64 tv_nsec; })];
 };
 
 struct snd_ctl_tlv {