diff mbox series

zonefs: Fix the wrong format specifier

Message ID 20241111054126.2929-1-zhujun2@cmss.chinamobile.com (mailing list archive)
State New
Headers show
Series zonefs: Fix the wrong format specifier | expand

Commit Message

Zhu Jun Nov. 11, 2024, 5:41 a.m. UTC
The format specifier of "signed int" in snprintf() should be "%d", not
"%u".

Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
 fs/zonefs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chaitanya Kulkarni Nov. 13, 2024, 5:55 p.m. UTC | #1
On 11/10/24 21:41, Zhu Jun wrote:
> The format specifier of "signed int" in snprintf() should be "%d", not
> "%u".
>
> Signed-off-by: Zhu Jun<zhujun2@cmss.chinamobile.com>

Indeed :-
794         int f;

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck
diff mbox series

Patch

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