Thread (10 messages) 10 messages, 2 authors, 2023-10-12

Re: [PATCH v7 1/5] lib/bitmap: add bitmap_{read,write}()

From: Alexander Potapenko <glider@google.com>
Date: 2023-10-12 12:55:48
Also in: lkml

I realized that the corner case with these functions is when agnostic user
wants to read / write > 32 bits at a time without ifdeffery applied.
Shall we change

        if (unlikely(!nbits))
                return;

to

        if (unlikely(!nbits || nbits > BITS_PER_LONG))
                return;

?
At bare minimum this has to be documented explicitly, that callers
may have an issue of the above calls on 32-bit platforms.
Given that bitmap_read() returns an unsigned long, and bitmap_write()
writes an unsigned long, passing a 64-bit value would be a bug.
But you are right, documenting this won't hurt.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help