diff options
-rw-r--r-- | sys/kern/vfs_lockf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/vfs_lockf.c b/sys/kern/vfs_lockf.c index b2a6af5c0ae..a7c6784fcd0 100644 --- a/sys/kern/vfs_lockf.c +++ b/sys/kern/vfs_lockf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_lockf.c,v 1.47 2022/06/01 14:16:28 visa Exp $ */ +/* $OpenBSD: vfs_lockf.c,v 1.48 2022/06/01 14:18:43 visa Exp $ */ /* $NetBSD: vfs_lockf.c,v 1.7 1996/02/04 02:18:21 christos Exp $ */ /* @@ -251,6 +251,9 @@ lf_advlock(struct lockf_state **state, off_t size, caddr_t id, int op, if (fl->l_len - 1 > LLONG_MAX - start) return (EOVERFLOW); end = start + (fl->l_len - 1); + /* Avoid ambiguity at the end of the range. */ + if (end == LLONG_MAX) + end = -1; } else if (fl->l_len < 0) { if (start + fl->l_len < 0) return (EINVAL); |