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-prev] [day] [month] [year] [list]
Message-ID: <901d37b0-d4c3-4ad2-b768-fc87d28c5a20@kernel.org>
Date: Mon, 9 Dec 2024 08:17:38 +0900
From: Damien Le Moal <dlemoal@...nel.org>
To: Zhu Jun <zhujun2@...s.chinamobile.com>
Cc: naohiro.aota@....com, jth@...nel.org, linux-fsdevel@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] zonefs: Fix the wrong format specifier

On 11/11/24 14:41, Zhu Jun wrote:
> The format specifier of "signed int" in snprintf() should be "%d", not
> "%u".

My apologies for the late reply.

A better fix is to make f "unsigned int" as that is consistent with
g_nr_zones and the fact that up to "unsigned int" total number of zones are
allowed for a zoned device.

Can you send a v2 ? Also please add a Fixes tag.

> 
> Signed-off-by: Zhu Jun <zhujun2@...s.chinamobile.com>
> ---
>  fs/zonefs/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
> index faf1eb87895d..43c2f4a59b50 100644
> --- a/fs/zonefs/super.c
> +++ b/fs/zonefs/super.c
> @@ -811,7 +811,7 @@ static int zonefs_readdir_zgroup(struct file *file,
>  	for (f = ctx->pos - 2; f < zgroup->g_nr_zones; f++) {
>  		z = &zgroup->g_zones[f];
>  		ino = z->z_sector >> sbi->s_zone_sectors_shift;
> -		fname_len = snprintf(fname, ZONEFS_NAME_MAX - 1, "%u", f);
> +		fname_len = snprintf(fname, ZONEFS_NAME_MAX - 1, "%d", f);
>  		if (!dir_emit(ctx, fname, fname_len, ino, DT_REG))
>  			break;
>  		ctx->pos++;


-- 
Damien Le Moal
Western Digital Research

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ