Re: [PATCH] kfifo: DECLARE_KIFO_PTR(fifo, u64) does not work on arm 32 bit

From: Greg KH
Date: Thu Jul 08 2021 - 11:36:55 EST


On Thu, Jul 08, 2021 at 10:23:41AM -0500, Matthew Weber wrote:
> From: Sean Young <sean@xxxxxxxx>
>
> If you try to store u64 in a kfifo (or a struct with u64 members),
> then the buf member of __STRUCT_KFIFO_PTR will cause 4 bytes
> padding due to alignment (note that struct __kfifo is 20 bytes
> on 32 bit).
>
> That in turn causes the __is_kfifo_ptr() to fail, which is caught
> by kfifo_alloc(), which now returns EINVAL.
>
> So, ensure that __is_kfifo_ptr() compares to the right structure.
>
> Signed-off-by: Sean Young <sean@xxxxxxxx>
> Acked-by: Stefani Seibold <stefani@xxxxxxxxxxx>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxxx>
> Signed-off-by: Matthew Weber <matthew.weber@xxxxxxxxxxx>
> ---
>
> This patch originally made it into 4.16 as
> 8a866fee3909c49738e1c4429a8d2b9bf27e015d but is a bug on at least 4.14
> for any 32bit system(PPC/ARM/...) using kfifo with u64 datatypes.
>
> Please add to linux-4.14.y for the next LTS tag.
> (Below patch is a cherry-pick of the commit onto linux-4.14.y and was
> verified on 32bit hardware.)

Now queued up, thanks.

greg k-h