summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust2014-02-12 15:36:59 +0100
committerTrond Myklebust2014-02-20 03:21:01 +0100
commit2c64c57dfc4b7946f7abd8af653f55af581bc2c3 (patch)
treeac1741fe6177634056d41ba1437d122fc778a403 /fs/nfs
parentNFS: Be more aggressive in using readdirplus for 'ls -l' situations (diff)
downloadkernel-qcow2-linux-2c64c57dfc4b7946f7abd8af653f55af581bc2c3.tar.gz
kernel-qcow2-linux-2c64c57dfc4b7946f7abd8af653f55af581bc2c3.tar.xz
kernel-qcow2-linux-2c64c57dfc4b7946f7abd8af653f55af581bc2c3.zip
NFSv4.1: Fix wraparound issues in pnfs_seqid_is_newer()
Subtraction of signed integers does not have well defined wraparound semantics in the C99 standard. In order to be wraparound-safe, we have to use unsigned subtraction, and then cast the result. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/pnfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 4755858e37a0..6e67ada6c22c 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -662,7 +662,7 @@ pnfs_destroy_all_layouts(struct nfs_client *clp)
*/
static bool pnfs_seqid_is_newer(u32 s1, u32 s2)
{
- return (s32)s1 - (s32)s2 > 0;
+ return (s32)(s1 - s2) > 0;
}
/* update lo->plh_stateid with new if is more recent */