mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 23:29:46 +00:00
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>
This commit is contained in:
parent
311324ad17
commit
2c64c57dfc
@ -662,7 +662,7 @@ pnfs_destroy_all_layouts(struct nfs_client *clp)
|
|||||||
*/
|
*/
|
||||||
static bool pnfs_seqid_is_newer(u32 s1, u32 s2)
|
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 */
|
/* update lo->plh_stateid with new if is more recent */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user