orangefs: sanitize pvfs2_convert_time_field()
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 9 Oct 2015 02:02:00 +0000 (22:02 -0400)
committerMike Marshall <hubcap@omnibond.com>
Fri, 13 Nov 2015 16:54:05 +0000 (11:54 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
fs/orangefs/pvfs2-kernel.h
fs/orangefs/pvfs2-utils.c

index c36868be03dce04a60697a5cf0c3e968e0d0c065..e962517179666820177fd3cd9a5afa6027d13145 100644 (file)
@@ -638,7 +638,10 @@ int pvfs2_unmount_sb(struct super_block *sb);
 
 int pvfs2_cancel_op_in_progress(__u64 tag);
 
-__u64 pvfs2_convert_time_field(void *time_ptr);
+static inline __u64 pvfs2_convert_time_field(const struct timespec *ts)
+{
+       return (__u64)ts->tv_sec;
+}
 
 int pvfs2_normalize_to_errno(__s32 error_code);
 
index c33e7193599c165e8b9377ff84817102556ce0b0..1180a2480d2bd37e472c42dd9b755668325b5aef 100644 (file)
@@ -298,7 +298,7 @@ static inline int copy_attributes_from_inode(struct inode *inode,
                attrs->mask |= PVFS_ATTR_SYS_ATIME;
                if (iattr->ia_valid & ATTR_ATIME_SET) {
                        attrs->atime =
-                           pvfs2_convert_time_field((void *)&iattr->ia_atime);
+                           pvfs2_convert_time_field(&iattr->ia_atime);
                        attrs->mask |= PVFS_ATTR_SYS_ATIME_SET;
                }
        }
@@ -306,7 +306,7 @@ static inline int copy_attributes_from_inode(struct inode *inode,
                attrs->mask |= PVFS_ATTR_SYS_MTIME;
                if (iattr->ia_valid & ATTR_MTIME_SET) {
                        attrs->mtime =
-                           pvfs2_convert_time_field((void *)&iattr->ia_mtime);
+                           pvfs2_convert_time_field(&iattr->ia_mtime);
                        attrs->mask |= PVFS_ATTR_SYS_MTIME_SET;
                }
        }
@@ -653,15 +653,6 @@ void set_signals(sigset_t *sigset)
        sigprocmask(SIG_SETMASK, sigset, NULL);
 }
 
-__u64 pvfs2_convert_time_field(void *time_ptr)
-{
-       __u64 pvfs2_time;
-       struct timespec *tspec = (struct timespec *)time_ptr;
-
-       pvfs2_time = (__u64) ((time_t) tspec->tv_sec);
-       return pvfs2_time;
-}
-
 /*
  * The following is a very dirty hack that is now a permanent part of the
  * PVFS2 protocol. See protocol.h for more error definitions.