Partially revert "kfifo: fix kfifo_alloc() and kfifo_init()"
Commit dfe2a77f ("kfifo: fix kfifo_alloc() and kfifo_init()") made the kfifo code round the number of elements up. That was good for __kfifo_alloc(), but it's actually wrong for __kfifo_init(). The difference? __kfifo_alloc() will allocate the rounded-up number of elements, but __kfifo_init() uses an allocation done by the caller. We can't just say "use more elements than the caller allocated", and have to round down. The good news? All the normal cases will be using power-of-two arrays anyway, and most users of kfifo's don't use kfifo_init() at all, but one of the helper macros to declare a KFIFO that enforce the proper power-of-two behavior. But it looks like at least ibmvscsis might be affected. The bad news? Will Deacon refers to an old thread and points points out that the memory ordering in kfifo's is questionable. See https://firstname.lastname@example.org/ for more. Fixes: dfe2a77f ("kfifo: fix kfifo_alloc() and kfifo_init()") Reported-by: laokz <email@example.com> Cc: Stefani Seibold <firstname.lastname@example.org> Cc: Andrew Morton <email@example.com> Cc: Dan Carpenter <firstname.lastname@example.org> Cc: Greg KH <email@example.com> Cc: Kees Cook <firstname.lastname@example.org> Cc: Will Deacon <email@example.com> Signed-off-by: Linus Torvalds <firstname.lastname@example.org>