diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -1915,8 +1915,8 @@ pi = OFF_TO_IDX(off + PAGE_MASK); error = 0; - /* Handle the case when offset is beyond shm size */ - if ((off_t)len < 0) { + /* Handle the case when offset is on or beyond shm size. */ + if ((off_t)len <= 0) { *offset = shmfd->shm_size; *length = 0; return (0);