2023-07-21 23:07:05

by Bilbao, Carlos

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

On 7/17/23 9:18 AM, Carlos Bilbao wrote:
> From: amd <[email protected]>
>
> 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.
>
> Reviewed-by: Carlos Bilbao <[email protected]>
This should have been:

Signed-off-by: Carlos Bilbao <[email protected]>

> ---
> block/blk-iocost.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/blk-iocost.c b/block/blk-iocost.c
> index 495396425bad..4721009a3f03 100644
> --- a/block/blk-iocost.c
> +++ b/block/blk-iocost.c
> @@ -3032,7 +3032,7 @@ static u64 ioc_weight_prfill(struct seq_file *sf, struct blkg_policy_data *pd,
> struct ioc_gq *iocg = pd_to_iocg(pd);
>
> if (dname && iocg->cfg_weight)
> - seq_printf(sf, "%s %u\n", dname, iocg->cfg_weight / WEIGHT_ONE);
> + seq_printf(sf, "%s %u\n", dname, (unsigned int)(iocg->cfg_weight / (unsigned int)WEIGHT_ONE));
> return 0;
> }
>
> @@ -3042,7 +3042,7 @@ static int ioc_weight_show(struct seq_file *sf, void *v)
> struct blkcg *blkcg = css_to_blkcg(seq_css(sf));
> struct ioc_cgrp *iocc = blkcg_to_iocc(blkcg);
>
> - seq_printf(sf, "default %u\n", iocc->dfl_weight / WEIGHT_ONE);
> + seq_printf(sf, "default %u\n", (unsigned int) (iocc->dfl_weight / (unsigned int)WEIGHT_ONE));
> blkcg_print_blkgs(sf, blkcg, ioc_weight_prfill,
> &blkcg_policy_iocost, seq_cft(sf)->private, false);
> return 0;

Thanks,
Carlos


2023-07-22 01:24:56

by Tejun Heo

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

On Fri, Jul 21, 2023 at 05:32:04PM -0500, Carlos Bilbao wrote:
> On 7/17/23 9:18 AM, Carlos Bilbao wrote:
> > From: amd <[email protected]>
> >
> > 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.
> >
> > Reviewed-by: Carlos Bilbao <[email protected]>
> This should have been:
>
> Signed-off-by: Carlos Bilbao <[email protected]>

Carlos, can you please retest the current linus#master?

Thanks.

--
tejun

2023-07-31 15:40:40

by Bilbao, Carlos

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

On 7/21/23 20:14, Tejun Heo wrote:
> On Fri, Jul 21, 2023 at 05:32:04PM -0500, Carlos Bilbao wrote:
>> On 7/17/23 9:18 AM, Carlos Bilbao wrote:
>>> From: amd <[email protected]>
>>>
>>> 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.
>>>
>>> Reviewed-by: Carlos Bilbao <[email protected]>
>> This should have been:
>>
>> Signed-off-by: Carlos Bilbao <[email protected]>
>
> Carlos, can you please retest the current linus#master?
>

Yes, that version compiled successfully without changes in my compiler. The
kernel that gave me said error was a custom v6.1.0-rc4 (Obtained from:
https://github.com/coconut-svsm/linux/tree/svsm-host)

> Thanks.
>

Thanks,
Carlos