On Fri, Apr 11, 2025 at 10:18:55AM +0200, Hanna Czenczek wrote:
> >           if (ret && ret != -ENOTSUP) {
> > -            goto out;
> > +            if (ret == -EINVAL && (offset % align != 0 || num % align != 
> > 0)) {
> 
> Could use `(offset | num) % align != 0`, but either way:

Use of | and & to perform alignment checks only works if align is
guaranteed to be a power of 2.  But isn't there (odd) hardware out
there with something like a 15M alignment, at which point you HAVE to
do separate checks with % because bitwise ops no longer work?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org


Reply via email to