summaryrefslogtreecommitdiffstats
path: root/fs/orangefs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-10-08 22:02:00 -0400
committerMike Marshall <hubcap@omnibond.com>2015-11-13 11:54:05 -0500
commit5714156be232b088e24c74fe4e95cb900a8b12e0 (patch)
treefeb571ba656882301d7e94221a4b1a8106a93587 /fs/orangefs
parentaada5c5872aa3048980a0e6926efd9086dc98532 (diff)
orangefs: sanitize pvfs2_convert_time_field()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs')
-rw-r--r--fs/orangefs/pvfs2-kernel.h5
-rw-r--r--fs/orangefs/pvfs2-utils.c13
2 files changed, 6 insertions, 12 deletions
diff --git a/fs/orangefs/pvfs2-kernel.h b/fs/orangefs/pvfs2-kernel.h
index c36868be03dc..e96251717966 100644
--- a/fs/orangefs/pvfs2-kernel.h
+++ b/fs/orangefs/pvfs2-kernel.h
@@ -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);
diff --git a/fs/orangefs/pvfs2-utils.c b/fs/orangefs/pvfs2-utils.c
index c33e7193599c..1180a2480d2b 100644
--- a/fs/orangefs/pvfs2-utils.c
+++ b/fs/orangefs/pvfs2-utils.c
@@ -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.