lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <93557f79-c12c-3c3f-2c25-9ba50a618daa@amd.com>
Date:   Fri, 21 Jul 2023 17:32:04 -0500
From:   Carlos Bilbao <carlos.bilbao@....com>
To:     tj@...nel.org, josef@...icpanda.com, axboe@...nel.dk
Cc:     cgroups@...r.kernel.org, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org, amd <amd@...alhost.localdomain>
Subject: Re: [PATCH] blk-iocost: fix seq_printf compile type mismatch error

On 7/17/23 9:18 AM, Carlos Bilbao wrote:
> From: amd <amd@...alhost.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.
> 
> Reviewed-by: Carlos Bilbao <carlos.bilbao@....com>
This should have been:

Signed-off-by: Carlos Bilbao <carlos.bilbao@....com>

> ---
>  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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ