mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-17 22:23:45 -04:00
timex: use __kernel_timex internally
struct timex is not y2038 safe.
Replace all uses of timex with y2038 safe __kernel_timex.
Note that struct __kernel_timex is an ABI interface definition.
We could define a new structure based on __kernel_timex that
is only available internally instead. Right now, there isn't
a strong motivation for this as the structure is isolated to
a few defined struct timex interfaces and such a structure would
be exactly the same as struct timex.
The patch was generated by the following coccinelle script:
virtual patch
@depends on patch forall@
identifier ts;
expression e;
@@
(
- struct timex ts;
+ struct __kernel_timex ts;
|
- struct timex ts = {};
+ struct __kernel_timex ts = {};
|
- struct timex ts = e;
+ struct __kernel_timex ts = e;
|
- struct timex *ts;
+ struct __kernel_timex *ts;
|
(memset \| copy_from_user \| copy_to_user \)(...,
- sizeof(struct timex))
+ sizeof(struct __kernel_timex))
)
@depends on patch forall@
identifier ts;
identifier fn;
@@
fn(...,
- struct timex *ts,
+ struct __kernel_timex *ts,
...) {
...
}
@depends on patch forall@
identifier ts;
identifier fn;
@@
fn(...,
- struct timex *ts) {
+ struct __kernel_timex *ts) {
...
}
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: linux-alpha@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
committed by
Arnd Bergmann
parent
1a596398a3
commit
ead25417f8
@@ -265,25 +265,25 @@ COMPAT_SYSCALL_DEFINE2(settimeofday, struct old_timeval32 __user *, tv,
|
||||
|
||||
SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
|
||||
{
|
||||
struct timex txc; /* Local copy of parameter */
|
||||
struct __kernel_timex txc; /* Local copy of parameter */
|
||||
int ret;
|
||||
|
||||
/* Copy the user data space into the kernel copy
|
||||
* structure. But bear in mind that the structures
|
||||
* may change
|
||||
*/
|
||||
if (copy_from_user(&txc, txc_p, sizeof(struct timex)))
|
||||
if (copy_from_user(&txc, txc_p, sizeof(struct __kernel_timex)))
|
||||
return -EFAULT;
|
||||
ret = do_adjtimex(&txc);
|
||||
return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret;
|
||||
return copy_to_user(txc_p, &txc, sizeof(struct __kernel_timex)) ? -EFAULT : ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||
int get_old_timex32(struct timex *txc, const struct old_timex32 __user *utp)
|
||||
int get_old_timex32(struct __kernel_timex *txc, const struct old_timex32 __user *utp)
|
||||
{
|
||||
struct old_timex32 tx32;
|
||||
|
||||
memset(txc, 0, sizeof(struct timex));
|
||||
memset(txc, 0, sizeof(struct __kernel_timex));
|
||||
if (copy_from_user(&tx32, utp, sizeof(struct old_timex32)))
|
||||
return -EFAULT;
|
||||
|
||||
@@ -311,7 +311,7 @@ int get_old_timex32(struct timex *txc, const struct old_timex32 __user *utp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int put_old_timex32(struct old_timex32 __user *utp, const struct timex *txc)
|
||||
int put_old_timex32(struct old_timex32 __user *utp, const struct __kernel_timex *txc)
|
||||
{
|
||||
struct old_timex32 tx32;
|
||||
|
||||
@@ -344,7 +344,7 @@ int put_old_timex32(struct old_timex32 __user *utp, const struct timex *txc)
|
||||
|
||||
COMPAT_SYSCALL_DEFINE1(adjtimex, struct old_timex32 __user *, utp)
|
||||
{
|
||||
struct timex txc;
|
||||
struct __kernel_timex txc;
|
||||
int err, ret;
|
||||
|
||||
err = get_old_timex32(&txc, utp);
|
||||
|
||||
Reference in New Issue
Block a user