lkml.org 
[lkml]   [2006]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/4 - 2.6.15]net: 32 bit (socket layer) ioctl emulation for 64 bit kernels
Date
On Thursday 12 January 2006 06:02, Shaun Pereira wrote:
> +int compat_sock_get_timestamp(struct sock *sk, struct timeval __user
> *userstamp)
> +{
> +       struct compat_timeval __user *ctv;
> +       ctv = (struct compat_timeval __user*) userstamp;
> +       if(!sock_flag(sk, SOCK_TIMESTAMP))
> +               sock_enable_timestamp(sk);
> +       if(sk->sk_stamp.tv_sec == -1)
> +               return -ENOENT;
> +       if(sk->sk_stamp.tv_sec == 0)
> +               do_gettimeofday(&sk->sk_stamp);
> +       return copy_to_user(ctv, &sk->sk_stamp, sizeof(struct
> compat_timeval)) ?
> +                       -EFAULT : 0;
> +}

This looks wrong, you're not doing any conversion here.
You cannot just copy sk_stamp to ctv, they are not compatible.
See compat_sys_gettimeofday on how to copy a struct timeval
correctly.

The other patches look good.

Arnd <><
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-01-12 20:26    [W:0.490 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site