Re: [PATCH] blk-iocost: fix seq_printf compile type mismatch error

From: 'Tejun Heo'
Date: Thu Jul 20 2023 - 16:07:00 EST


On Wed, Jul 19, 2023 at 08:57:32AM +0000, David Laight wrote:
> From: Tejun Heo
> > Sent: 17 July 2023 19:49
> >
> > On Mon, Jul 17, 2023 at 09:18:52AM -0500, Carlos Bilbao wrote:
> > > From: amd <amd@localhost.localdomain>
> > >
> > > Fix two type mismatch errors encountered while compiling blk-iocost.c with
> > > GCC version 13.1.1 that involved constant operator WEIGHT_ONE. Cast the
> > > result of the division operation to (unsigned int) to match the expected
> > > format specifier %u in two seq_printf invocations.
> >
> > Can you detail the warnings? Was that on 32bit compiles?
>
> The problem is caused by gcc 13 changing the types of the
> constants inside an enum to be all the same.
>
> The best fix is (probably) to replace all the enum used to
> define unrelated constants with #defines.

Yeah, but then you end up without any way to read that value from outside
the kernel for BPF, drgn or any other tools which use debug info. That
actually matters.

Thanks.

--
tejun