diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-10-01 01:32:32 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-10-01 01:32:32 -0400 |
commit | bcb6f6d2b9c299db32b20f4357c36a101e7f0293 (patch) | |
tree | 65dcb451a0853740d05a4eb6e1f3df1ce8b515f8 /fs/fuse | |
parent | f75fdf22b0a84702d1b72fc1ccd53dcdde121c16 (diff) |
fuse: use timespec64
And check for valid nsec value before passing into timespec64_to_jiffies().
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dir.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 45f704aaa57f..30d9dc976e61 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -63,11 +63,15 @@ static inline u64 fuse_dentry_time(struct dentry *entry) | |||
63 | /* | 63 | /* |
64 | * Calculate the time in jiffies until a dentry/attributes are valid | 64 | * Calculate the time in jiffies until a dentry/attributes are valid |
65 | */ | 65 | */ |
66 | static u64 time_to_jiffies(unsigned long sec, unsigned long nsec) | 66 | static u64 time_to_jiffies(u64 sec, u32 nsec) |
67 | { | 67 | { |
68 | if (sec || nsec) { | 68 | if (sec || nsec) { |
69 | struct timespec ts = {sec, nsec}; | 69 | struct timespec64 ts = { |
70 | return get_jiffies_64() + timespec_to_jiffies(&ts); | 70 | sec, |
71 | max_t(u32, nsec, NSEC_PER_SEC - 1) | ||
72 | }; | ||
73 | |||
74 | return get_jiffies_64() + timespec64_to_jiffies(&ts); | ||
71 | } else | 75 | } else |
72 | return 0; | 76 | return 0; |
73 | } | 77 | } |