/* rw_verify_area doesn't like huge counts. We limit them to something that fits in "int" so that others won't have to do range checks all the time.  */
ssize_t rw_verify_area(struct dfs_file *file, off_t *ppos, size_t count)
/* rw_verify_area doesn't like huge counts. We limit them to something that fits in "int" so that others won't have to do range checks all the time.  */
ssize_t rw_verify_area(struct dfs_file *file, off_t *ppos, size_t count)
{
    off_t pos;
    ssize_t retval = -EINVAL;
    if ((size_t)count < 0)
        return retval;
    pos = *ppos;
    if (pos < 0)
    {
        if (count >= -pos)
            return -EOVERFLOW;
    }
    return count > MAX_RW_COUNT ? MAX_RW_COUNT : count;
}