From: Li Zefan <lizf@cn.fujitsu.com>
To: Theodore Tso <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/3] ext4: add EXT4_IOC_GETCRTIME ioctl
Date: Mon, 18 Aug 2008 10:08:11 +0800 [thread overview]
Message-ID: <48A8D98B.9020701@cn.fujitsu.com> (raw)
In-Reply-To: <20080810022643.GC14756@mit.edu>
(sorry for the so dealyed reply, I was offline last week.)
Theodore Tso wrote:
> On Wed, Aug 06, 2008 at 05:09:07PM +0800, Li Zefan wrote:
>> + case EXT4_IOC_GETCRTIME:
>> + return put_user(ei->i_crtime, (struct timespec __user *)arg);
>> +
>
> I'm worried about writing a struct timespec directly to user space,
> because the kernel's idea of what is struct timespec might not be the
> same as the userspace's understanding of struct timespec ---
We have system call nanosleep(), which copies a struct timespec directly
from user space.
> specifically, because of the question of the width of time_t might be
> different in the kernel and in userspace on different architectures.
>
But timeval.tv_sec is also of type time_t. Also sys_time() writes a time_t
directry to user space.
I should not use put_user() though...
+ return copy_to_user((struct timespec __user *)arg,
+ &ei->i_crtime, sizeof(ei->i_crtime));
> I think we would be better off explicitly defining a structure, or
> just returning the seconds and nanoseconds in explicit primitive
> types.
>
next prev parent reply other threads:[~2008-08-18 2:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-06 9:09 [PATCH 1/3] ext4: add EXT4_IOC_GETCRTIME ioctl Li Zefan
2008-08-10 2:26 ` Theodore Tso
2008-08-18 2:08 ` Li Zefan [this message]
2008-08-18 2:36 ` Theodore Tso
2008-08-18 9:01 ` Andreas Dilger
2008-08-18 10:03 ` Li Zefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48A8D98B.9020701@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).