]> git.karo-electronics.de Git - linux-beck.git/commitdiff
fuse: use timespec64
authorMiklos Szeredi <mszeredi@redhat.com>
Sat, 1 Oct 2016 05:32:32 +0000 (07:32 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Sat, 1 Oct 2016 05:32:32 +0000 (07:32 +0200)
And check for valid nsec value before passing into timespec64_to_jiffies().

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dir.c

index 45f704aaa57f6e3134abf0129cc8a371612ce086..30d9dc976e61baf1544edc2dec14e9018ff2ad01 100644 (file)
@@ -63,11 +63,15 @@ static inline u64 fuse_dentry_time(struct dentry *entry)
 /*
  * Calculate the time in jiffies until a dentry/attributes are valid
  */
-static u64 time_to_jiffies(unsigned long sec, unsigned long nsec)
+static u64 time_to_jiffies(u64 sec, u32 nsec)
 {
        if (sec || nsec) {
-               struct timespec ts = {sec, nsec};
-               return get_jiffies_64() + timespec_to_jiffies(&ts);
+               struct timespec64 ts = {
+                       sec,
+                       max_t(u32, nsec, NSEC_PER_SEC - 1)
+               };
+
+               return get_jiffies_64() + timespec64_to_jiffies(&ts);
        } else
                return 0;
 }