return EINVAL if uio_resid is too small